Sunday, April 24, 2011

Algorithm


If you need to get a computer to do a particular task you can program it. Writing a computer program involves describing the solution in a computer language. One does not directly start writing a program in the computer. You are required to analyze the problem, design a solution and to test the solution before you come to the coding phase.

Just imagine that your parents are going to construct a new house. They might discuss with you how many bedrooms they are going to have etc, whether it’s a two story house. It is unlikely that your parents will get a mason and start building the house directly. Just imagine after constructing the house half way through your parents figure out that the living room is too small. Instead they will get an Architect to draw some plans of the house first, they might show you these plans, so you could visualize how the new house would look like. You and your parents could make changes to the house and have the plans redrawn. After every one is happy about the new house, your parents could meet a contractor and start constructing the house.


Programming is very similar, coding directly is usually not a good idea even for small problems. You need to do some planning before hand. There are many ways that you could represent your solution to the problem (algorithm). There are graphical techniques like flow charts, and textual methods like pseudo code. Once you are satisfied that your solution will work you can convert this into a programming language.

 

No comments:

Post a Comment