When you are telling the computer what to do, you also get to choose how it’s going to do it.
An Algorithm is a step by step instructions to solve a given problem.
Let us consider the problem of preparing tea.
- Put the teabag in a cup.
- Fill the kettle with water.
- Boil the water in the kettle.
- Pour some of the boiled water into the cup.
- Add milk to the cup.
- Add sugar to the cup.
- Stir the tea.
- Drink the tea.
Why Analysis of Algorithms?
We have the different way to doing any work but to know which way or method is most efficient in all terms or any particular term. For example:
- We have many search algorithms like linear search and binary search, these are different and their approach is also different but their goal and purpose is sorting. Algorithm analysis helps us determining which of them in terms of time and space consumed.
Leave a Reply