Expressing Algorithms

This week, we learned a lot of content. We learned how algorithms are very important, and since they are so important, we also learned how to design algorithms using different expressions and use them to solve problems.

Algorithms all around us

Initially, algorithms may seem like a very faraway and foreign concept to us, reserved only for mathematical geniuses and IT technicians. However, they actually permeate our every day life and the modern world.  During class, we watched a video called “The Secret Rules of Modern Living: Algorithms”. It is a documentary talking about and explaining different algorithms in our everyday lives. One algorithm is Google’s PageRank algorithm. Initially, most other search engines sorted search results by ranking websites by pure popularity and number of views. The founders of Google came up with a better algorithm that considered how many other websites referred to a certain website and the credibility and popularity of the other websites in order to rank websites. This new algorithm came up with much more relevant search results and led Google to the massive success that it has today. Another algorithm is the face-recognition algorithm that phone cameras use. The camera scans the pixels on your face, row-by-row, and then compares them to the pattern of a general face. If the pixels are in a similar pattern to that of a general face, then it will recognize your face as a face. One other neat algorithm is the match-making algorithm, which matches pairs after taking their preferences are taken into account. The pairs are separated based off of the computer finding the way to keep the most people satisfied.

f1
A visual representation of the PageRank algorithm. The players are akin to websites. The more people pass to you, and the more popular the players that pass to you are, the higher your ranking is.

Algorithm-type thinking

We also watched a short clip on designing algorithms to solve problems. The author of the video devised multiple algorithms to count the number of people in a room. Initially, the algorithm used a loop where it would count people one by one. However, this was too slow, so he changed the algorithm to count people by pairs. Initially, I thought the algorithm wouldn’t work, because there might be cases where there are an odd number of people in the room. However, the author was one step ahead of me. To make the algorithm not buggy, he also added an “else if” condition where if there was no pairs left, the computer would still be able to count the left over person so the outputted result was the correct number of people in the room. Technically, you could make it so that the computer counted even more people at one time, but then you would have to add other conditions and make the algorithm more complicated to account for situations where there are left over people after counting or there are less people than the amount that the computer counts at one time. When designing algorithms, in addition to having definitenesseffectiveness, finiteness and having an input and an output, you have to strike a balance between the speed at which it can run and how complicated it is. 

Screen Shot 2018-10-24 at 00.28.59.png

Expressing Algorithms

There are different ways to express algorithms. They are not just limited to computing language. Actually, humans have been using different forms of algorithms for a long time by now. Some different common ways of expressing algorithms are flowcharts, pseudocode, code and natural language. Flowcharts are pretty simple pictures where you go along a process and go through different stages. At every stage, you make a decision based on the command, and this will decide which way you go along the flowchart. Pseudocode uses individual English words such as “or”, “and”, “else if, etc. to express instructions. Code works the same as pseudocode, but is written in its own peculiar language that is understood by computers. And finally, natural language is using plain-spoken, normal English to give instructions for an algorithm.

In the video, the author used pseudocode so that normal people like us could understand. It was very helpful towards us understanding programming, because even though it’s not actual computing language, writing pseudocode uses the same logic and way of thinking when solving a problem as actual computer code.

Algorithms_+Pseudo+Code+&+Flow+Chart
A picture showing how to write pseudocode (and flowcharts!)

 

In the end…

We had very productive Computer Science classes this last week. We mainly learned about how algorithms are so widespread now, and how to understand them and design our own algorithms to solve problems.There is a good chance that I will need knowledge about algorithms for my career and life later on. By learning about algorithms, I feel that I have immensely improved my problem solving abilities. I’m really excited that I’ve learned the way of thinking for designing an algorithm, as it has provided the basis for me learning programming later on. This is both very important and helpful because as stated above, algorithms are so vital to our everyday lives in this age and will only grow more so. The future of algorithms is bright!

Leave a comment