1.3 – Algorithm and Analysis of Algorithm.

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.

  1. Put the teabag in a cup.
  2. Fill the kettle with water.
  3. Boil the water in the kettle.
  4. Pour some of the boiled water into the cup.
  5. Add milk to the cup.
  6. Add sugar to the cup.
  7. Stir the tea.
  8.  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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: