- An algorithm is a set of steps used to solve a problem.
- Typically you should write an algorithm in an out-line format, with at least 2 levels of detail.
- Often the higher-levels become functions or method (in OO).
- A good algorithm lists the necessary steps, in the proper order.
- At first, a step may not contain all the details - you should refine
it until it does.
- An
algorithmic pattern or a design pattern is a common set of steps that occurs in many programs.
- If you can't think of a good first-level for your outline, start with IPO:
- Input
- Process
- Output
- Picking the right level of detail can be tricky.
- If you were asked to explain how a car works, what would you respond? Would you start talking about the alternator and the spark plugs and the carburater?
Watch the Video Review of the Assignment:
Algorithm 1 - "Blowing up a Ballon"
Practice Algorithms
Team up and give them a try. Make sure you have at least 2-levels in an outline format. Try it on your own and the compare with your partner(s):