‘We Like Lists Because We Don’t Want to Die’ — Umberto Eco
In our daily life we have many different lists, for example, the shopping list, the grocery list, the laundry list, the menu etc. We also have dizzying arrays around us: list of stars in the night sky, many different plants, animals, 7 billion people with different classes, race, and religion. There are also millions of deities that humans worship, for instance, in Hinduism alone there are 33 million deities.
In the material world there are more than 20 million known organic molecules and everyday new ones are added to the list. Average human body is consists of 37.2 trillions of cells which carries out millions of different enzymatic reactions at any particular time without us telling them what to do next. We also carry 39 trillions of bacteria in an average human body. In fact, we are outnumbered by the bacteria cells that are cohabitant with us. For this reason some biologists preferred to call us ‘bacterial bus’. Next time when you are too concerned about your ‘self’ give it a thought.
Making list is our way of expressing the inexpressible. Lists are our way of making sense of the numerous things around us. An attempt to comprehend the incomprehensible chaos that prevails in our surroundings. It is to help us describe, to categorize the ‘ten thousand things’. Otherwise, we can’t see the forest for the trees, they just overwhelm us.
‘The named is the mother of ten thousand things.’ — Tao Te Ching
People dealt with list very early on, most of the ancient civilizations have astronomical nomenclature for visible stars and constellations in the sky. This helped our ancestors to navigate, to calculate time, monitor seasonal changes and predict auspicious time for plantation and harvesting. Similarly through lists, through catalogs, through encyclopedias and dictionaries, through collections in the museums people tried to comprehend the vast number of natural objects that surrounded us.
Dictionary is a much older form of list, at least two millennia old. Encyclopedia also existed for a long time. Most famous 18th century French encyclopedists wanted to ‘provide a complete alphabetical treatment of the whole field of human knowledge from the standpoint of the “Enlightenment”.’
In programming we have from simple lists to arrays, tuple, dictionary, json data, linked lists, different tree structures, and of course huge database. All of these can be thought of as some kind of lists/arrays. Some lists cannot be altered, like tuple in python. But in most cases we can manipulate lists, make a new list out of an existing list.
We can add an item to the list or delete an item using
pop() method respectively. Depending on the data structure we can add new item in the beginning of the array, at the end of array, or to any specific position. We just need to be aware of the data structure, because different data structure will give us different run-time complexity.
For instance, stack is just an array with two main operations: push and pop. Stack follows the “Last In, First Out” protocol (LIFO). Meaning push add elements to the top of the array, while pop removes them from the same location.
On the other hand, queues are arrays with two principle operations: unshift and pop. Queues follow the “First In, First Out” protocol (FIFO). Unshift enqueues or add items to the end of the array, whereas pop dequeues or remove items from the beginning of the array.
Linked lists are like arrays, they have sequential order of data items. One big difference is linked lists points to other elements instead of keeping indexes. The first node is called the head while the last node is called the tail. Though linked lists are like arrays, but data insertion and removal can be done only at the head.
Similarly different tree data structures are actually kind of linked list provided that each node can have no more than one parent. If a tree is free to have more than one parent, it becomes a Graph data structure.
What we have seen in the above discussion is that at the core of data structure is array. If we understand different types of arrays and know how to manipulate them then we are better off as a programmer. Arrays are essential to our understanding of nature and also in our understanding of data structures.
“Bad programmers worry about the code. Good programmers worry about data structures and their relationships.” — Linus Torvalds
Finally I want to end this with a funny note that I have recently heard from Wes Bos.
Why did the developer quit his job?
-Because he wants arrays!
10 Reasons Why We Love Making Lists
Why is it that everywhere you turn there's a list for this or that? On Facebook, friends recently began posting 25…
9 reasons why love lists: https://www.bbc.com/future/article/20150410-9-reasons-we-love-lists
Spiegel interview with Umberto Eco on the importance of lists: https://www.spiegel.de/international/zeitgeist/spiegel-interview-with-umberto-eco-we-like-lists-because-we-don-t-want-to-die-a-659577.html