Information can be organized in a number of ways, some of which give some pretty wicked benefits such as faster time to search.
For example, if you list your contact by name alphabetically on your phone, you can scroll to the beginning of the letter and quickly find the full name rather than searching every contact one by one.
The purposeful way computer programs store the information (data) is generally referred to as data structure.
Some useful data structures if you want to know more:
* Array (or Vector) pack information in a contiguous sequence next to each other, allowing computer to access any piece in any order randomly.
* HashMap (or Dictionary) uses fancy math to let you associate a piece of info (called key) with another (called value), such that you can find the value with a key as fast as you can.
* Linked list: Like Array but the information is not stored physically next to each other, so each piece needs to include the hint of where to find the next piece (or the previous one). This exists because you sometimes don’t have enough space for a continuous sequence to store the data, and so you need to just splinter them around. (and other benefits)
* Graph & Tree: Linked list but each piece of data can point to many other pieces, not just 1. Extremely powerful for many, many different problems.
Latest Answers