1.2 An Algorithm in Detail

Let’s take a look at a complete, concrete example of an algorithm. The following is an algorithm to make ramen noodles:

Algorithm: MakeRamen
boil water
add noodles to water
wait 6 minutes
drain the noodles
stir in contents of the flavour packet

This algorithm consists of six actions to solve the problem of making ramen noodles. The actions are taken in the order given, and the result, or output, of the algorithm, is a prepared bowl of steaming hot noodles, ready to eat. The critical thing to remember about algorithms is that the given actions must be taken in the given order. Otherwise, we are not following the algorithm, and there is no guarantee that the desired output is achieved.