Chapter 2: Algorithm


The list of procedures or steps for solving a problem is called algorithm.

Why is it needed

  1. Determine the correctness of the various steps

  2. Reduce the number of steps, if possible

  3. Increase the speed of solving the problem



A man asked a robot:

Take this 50 paisa coin, go to the post office and if available, buy two 25 paisa tickets.

The algorithm of the above job will be like this:

Step 1: Take this 50 paisa coin.

Step 2: Go to the post office.

Step 3: If available, go to Step 4.

            Otherwise go to Step 5.

Step 4: Buy two 25 paisa tickets.

Step 5: Exit.