Verbal – Algorithm representation

Part 2. Verbal representation

It seems to be the easiest and most understandable method of algorithm representation. The verbal representation is a kind of algorithm representation where all actions and conditions are represented in human natural language.

Imagine you want to tell your friend how to reach the museum. How can you do it? Exactly! You will tell him a bunch of bullets:

  • Go straight along the road.
  • At the second crossroads, turn left and keep walking straight until you reach the big square with a beautiful monument and fountains.
  • Look around, and you should see a yellow building with a red roof.
  • Cross the square towards that building.
  • The building next to it on the right is the Museum of Modern Art.
  • Have a good time!

And if you ask me, “What? Is it the algorithm?” I will confidently answer, “Yes! It’s definitely the algorithm!”. So, let me explain. As you already know from the introduction part (What is an algorithm?), any algorithm should have a starting point, an ending point, and some “magic” between them. In the example, the starting point is where you and your friend stand. The ending point is where your friend wants to reach (the Museum of Modern Art). The “magic” between them is your directions on how your friend can get his desired place.

It’s a simple example of the verbal algorithm. The other example of the verbal algorithm can be any instruction. Let’s imagine that you are a barista in a café. Your job is to prepare coffee for clients, and you have written instructions from your manager. The instructions contain what you should do (like I showed in the Block Diagram article).

  • Say greetings to the client.
  • Ask the client what coffee they would like.
    • The client wants an espresso.
      • Put the small cup into the machine.
      • Select the “Espresso” button.
      • Jump to the bullet for serving.
    • The client ordered an americano.
      • Put the medium cup into the machine.
      • Select the “Americano” button.
      • Ask the client if they would like it with milk.
        • If the client wants it with milk – add to the cup 2 oz of milk.
      • Jump to the bullet for serving.
    • The client asked for a cappuccino.
      • Ask the client for the size standard or big size.
        • For the standard size take a medium cup.
        • For the big size take a big cup.
      • Put the selected cup into the machine.
      • Select a proper button to prepare necessary amount of coffee.
        • For the standard size select the “Espresso” button.
        • For the big size select the “Americano” button.
      • Put 3 oz of milk into the special cup.
      • Prepare a milk foam for 30 seconds
      • Add foam to the coffee
      • Draw a pattern on the coffee with a milk foam
      • Jump to the bullet for serving.
  • Serving:
    • Put the cup of coffee onto the saucer.
    • Put the teaspoon onto the saucer.
    • Offer the client add sugar, cinnamon, or grated chocolate.
  • Wish the client a Bon appetite and a Good day.
  • Repeat from the beginning with the next client.

Woohoo! That wasn’t easy, was it? It’s an instruction for the barista to serve clients with coffee. And I assure you that it’s an algorithm, or rather a verbal algorithm in the written form. It is a complicated algorithm with different options, conditions, and even a loop – can you find it there?

Well, let’s disassemble the algorithm into components. The algorithm’s starting point is the client’s greeting. Then, every question for the client can be interpreted as a condition for the algorithm branch. Also, we have bullets for actions (steps) to prepare a coffee. The ending point is a prepared coffee and wishes for the client. And at last, the loop is the last bullet that directs us to the start of the instruction to repeat the same operations for the next client.

So, I showed you that the instruction is actually an algorithm that is written in human language but represents strict steps that should be done to achieve the goal. And moreover, if you check your daily routines, any lists with actions – you will probably see the algorithm under the hood from now. And I really hope you will!

Thanks for reading! See you!

Continue with: