Data structure refers to a programmatic scheme for organizing related pieces of information. It determines the way a computer program accesses, processes, and stores data. Some programming languages inherently support data structures, whereas other languages require an external library to use a data structure.
The list below contains some of the most common data structures. Each type has many variations that allow an end user to perform different sets of operations on the data.
Array structures contain a linear sequence of data, usually of a singular type. Arrays typically use a zero index, meaning the first element is assigned an index of 0, the second element an index of 1, and so on. To access a specific piece of data in the array, a user must know its index number.
A hash table or hash map is a non-linear data structure in which each element is assigned a unique computer hash. The hashes are usually of a fixed length and are produced using a predetermined key. Data lookups can be completed using a known hash or the key, which makes it an extremely efficient method of accessing large volumes of data.
Stacks and queues are linear sequences of data similar to arrays. With these types, however, the way the data is organized depends on when each piece was added to the data set. Stacks use a “last in first out” (LIFO) structure where the last element added is the first one removed. Queues use a similar approach with a “first in first out” (FIFO) structure instead, meaning the newest elements are added to the end of the sequence instead of the beginning.
A linked list is another linear sequence of data where the physical order of the data does not match the sequence. Instead, each element contains a “pointer” that indicates the next element in the sequence. This means all data in the list must be accessed in order, which makes it less efficient for large sets of data than other structures.
Trees are non-linear data structures based on a series of parent-child relationships. Data in these structures is accessed by starting with a single root node and following each branch until it ends with a single leaf node. These types of structures are common for establishing a hierarchy in wireless networks.
Graph structures are non-linear sequences that are organized according to each element’s spatial relationship. Each graph contains a finite number of elements, either vertices (points on the graph) or the edges that connect them. The order in which data is accessed depends on the type of graph.
This article was updated April 2021 by Kaiti Norton.