Examples of Algorithms
Congratulations, you have just written an algorithm! An algorithm is simply a set of instructions that can be followed to accomplish a task.
Algorithms are all around us. You can think of an algorithm as a bit like a recipe to be followed, and in fact recipes are great examples of algorithms.
Here are some more examples:
When sharing out a deck of cards, you’ll use an algorithm to ensure that the deck is divided equally between all of the players. The algorithm may look something like this:
Repeat until there are no cards left:
- Give a card to the player in front of you
- Turn clockwise to the next player
When creating an origami animal, you’ll have to precisely follow the instructions provided (the algorithm) in order to make sure that your animal looks as it should.
Computers also make use of (sometimes complex) algorithms to perform tasks, for example in sorting items into numerical or alphabetical order, helping you decide what video to watch next, or plotting your route home.
Google uses its PageRank algorithm to rank web pages in its search engine results. PageRank uses many factors to determine a page’s ranking, including counting the number (and quality) of links to a page.
Facebook uses its EdgeRank algorithm to decide which stories appear in your newsfeed. This is based on (amongst other things) how ‘connected’ you are to the person, and how likely you are to like or comment on the story.