Data Structures

Discover common linear data structures, such as arrays, lists, and dictionaries.

There are a large number of data structures that you will come across in programming, so much so that there are entire courses on this topic alone.

For now, we’ll summarize a few of the more common data structures that we’ll come across as a TPM listening and contributing to design reviews, standups, and various hallway conversations. The goal here isn’t to be an expert but to ensure we know enough to be comfortable in conversations and make informed decisions when appropriate.

Linear data structures

First up are linear data structures. These are a collection of objects that are accessed in a sequential fashion. The most common way to act upon a large dataset is to loop through each piece of data and perform the same manipulation on each one. As such, linear data structures are some of the most common data structures we will encounter. We’ll discuss the three most linear data structures common next.

Arrays

Arrays are a sequentially allocated collection of values or objects accessed via one or more indexes. The array can have multiple dimensions, the more common being a two-dimensional array, which can be visually thought of as a table with rows and columns. Arrays can also be multi-dimensional and behave like a one-dimensional array where the value is an array itself. Because an array is sequentially allocated in memory, accessing a particular index is constant—a O(1)O (1) complexity—since the index represents the distance in memory from the starting point of the array, so to get to the 50th element, we add 50 to the starting point in memory.

The below figure shows an array:

Get hands-on with 1200+ tech skills courses.