- a step-by-step procedure
- every program is essentially a step-by-step procedure
- so in essence algorithm design is designing your program
Why is algorithm design important?:
How to design an algorithm?:
An example algorithm for getting milk from the grocery store:
start
drive to the store
buy the milk
drive home
end
The details that were left out:
- turn on the car
- take out your wallet
- etc.
The top-down approach would be to:
- break the task of "getting milk from the grocery store" into smaller pieces, like "drive to the store", etc.
- Translate all the small pieces into a program.
The bottom-up approach would be to:
- develop the task of "drive to the store" and "drive home"
- after developing the above portions, "buy the milk" can be developed an added on