# The World Cup, Google, And The Omnipresent Sorting Theory

France were crowned the new world football champions in the summer. Croatia were the runners up.

The interesting question, then – can we confidently say Croatia was the second best team in the tournament? Would they have beaten Belgium or Brazil if either team had been in their half of the bracket?

While it is likely to be just a battle of your opinion versus mine, I’d hazard a guess that Belgium and Brazil were probably better teams. The challenge is that elimination via brackets does a good job identifying the winner. But, it does a poor job of finding second place. The best approach to finding the stack rank of the teams would be to do a comprehensive round robin where everyone plays each other – equivalent to the English Premier League for example. But, we don’t have time for that in the world cup. So, brackets are the way to go.

Sorting theory
In Computer Science, a sorting algorithm puts the elements of a list in a certain order. Computers, in many ways, are just sorting machines. They take vasts amounts of data and find ways to sort them intelligently and make them available when we need them.

Sorting theory is a key part of introductory computer science and it tends to be a popular interview question topic. Barack Obama was famously asked a question about the most efficient sorting algorithms in an interview at Google. That’s how mainstream sorting questions are. :-)

The efficacy of sorting algorithms is judged by the big O notation. It is the worst case scenario of time taken to sort “n” items. The first sorting aglorithms had a worst case performance of N^2 square. This means the performance gets really bad as the number of items increases. As a result, sorting and, by extension, computation was very expensive.

This was until the Merge sort came along.

Merge sort and life applications of sorting theory
The merge sort has legendary status among sorting algorithms because it made “linearithmic” sorting possible. The worst case is NlogN – effectively MUCH faster than previous sorting algorithms. (Wikipedia has a simple illustration of how merge sort works – if you are interested)

Merge sort is what you do when you split a large pile of laundry, split it into little piles, sort those piles, and then merge them together. The process of elimination in competitions via brackets is, thus, a variant of merge sort.

As Brian Christian and Tom Griffiths share in their book “Algorithms to Live By,” there are plenty of other such life applications of sorting. For example, sorting theory teaches us to never sort email into folders if searching is easy. Sorting is expensive (read: giant waste of time).

Sorting theory also teaches us to use “bucket sort” when possible. Bucket sort or bin sort is what you do when you just separate your laundry into various “bins.” Assuming a small number of bins, it gets sorting done in linear time.

We also see sorting theory play out in every organization via the pecking order. Pecking order was first observed in a brood of chickens who figure out their leadership order by pecking away at each other. The most powerful peckers are higher up in the order. Humans do it too – it is called politics and usually just requires two humans, a room, and some incentives.

Okay, so what does all this have to do with technology and the future?
Brian Christian and Tom Griffiths have a couple of intriguing questions for us here – What is Google? The default answer would be “search engine.”  But, is it really a search engine? Or, should it be called a “sort engine?”

The power of Google is not just in the searching but in its ability to do the sorting. In fact, we could make the argument that it is the efficacy of their sorting algorithm that makes Google the massive money making machine that it is. Google rose to power sorting results into pages with 10 relevant results. Over time, they added ads to the side and then on top and became one of the most valuable companies on the planet.

Let’s take a look at what Google’s sorting looks like right now. These are screenshots as I scroll down for a search for “mattress” – I’ve captured 8 screenshots from beginning to end and I’ve encircled the ads in red.

3 observations –

1. It took me 2 entire screen scrolls before I saw the first completely organic result.

2. I counted roughly 16 organic results/groups and 7 ads.

3. I don’t think I ever scroll past screen 2 – my guess is that I’m not the exception here.

Google, then, is still a sort engine. For most retail searches, however, it just sorts more ads these days than organic results.

Who gets to do the sorting for you?
There are two lucrative marketplaces on the internet – attention marketplaces and retail marketplaces. The biggest leading indicator for the success of a marketplace is whether or not they do the sorting for you.

If Facebook gets to sort the information you see through the course of a day (and, for a majority of the world’s adults, they do), the attention marketplace is theirs. And, if Google gets to sort the results of your retail searches, then they win big as well.

Understanding this truth about sorting explains a lot about the state of the big technology players today. Facebook – including Instagram, Whatsapp, et al – sorts the information the world sees every day. But, they’re working hard to invest in video because they don’t want Netflix and YouTube to sort what you watch.

The New York Times homepage used to be the most prestigious display of sorting two decades ago. It isn’t anymore. Old world publishers are, thus, falling by the wayside. The smarter ones are realizing that the only place they can do the sorting of information for their users is email. So, they’re doubling down on email and building subscription businesses on that (quaint?) piece of technology.

Disney, 21st Century Fox, and the like don’t want Netflix to sort the shows you want to watch. They’re scrambling. So are large telcos who’re finding ways to get in on this action.

Google, on the other hand, is targeting a different kind of foe. Google makes a lot of money off retail searches. But, increasingly, people are starting their retail searches on Amazon. Worse still, they’re able to do so by just talking to Alexa. From a monetization standpoint, that is an existential threat for Google. Google’s \$550M in Chinese retailer JD.com is just the tip of the iceberg for Google’s marketplace ambitions. Expect plenty more to follow.

One thing is for certain – In all these moves and the many more to come in the future, sorting will be omnipresent.

(Also posted elsewhere as part of the “Notes by Ada” Project)