Array
The two-dimensional array is the simplest data structure. A table can be seen as an array. For example:
This 2-dimensional array is a table with rows and columns:
- Each row represents a subject
- The columns the features that describe the subjects.
- Each column stores a certain type of data (integer, string, date …).
Though it’s great to store and visualize data, when you need to look for a specific value it sucks.
For example, if you want to find all the guys who work in the UK, you’ll have to look at each row to find if the row belongs to the UK. This will cost you N operations (N being the number of rows) which is not bad but could there be a faster way? This is where trees come into play.
Note: Most modern databases provide advanced arrays to store tables efficiently like heap-organized tables or index-organized tables. But it doesn’t change the problem of fast searching for a specific condition on a group of columns.