List of data structures

From Canonica AI

Abstract Data Types

An abstract data type (ADT) is a high-level description of a collection of data and the operations that can be performed on that data. It is a mathematical model of a data structure that specifies the type of data stored, the operations supported by the data structure, and the types of parameters of the operations. ADTs are used in the design of computer programs and are used to specify the behavior of data types within a program, but do not specify the implementation of the data types.

Linear Data Structures

Linear data structures are those in which data elements are arranged sequentially or linearly, where each element is connected to its previous and next element. The basic types of linear data structures include:

Arrays

An array is a collection of elements identified by array index or key. The elements in an array are usually of the same type and are stored in contiguous memory locations. Arrays can be one-dimensional or multi-dimensional.

A photo of a grid-like structure representing an array. Each cell in the grid contains a number, representing an element in the array.
A photo of a grid-like structure representing an array. Each cell in the grid contains a number, representing an element in the array.

Linked Lists

A linked list is a linear data structure where each element is a separate object. Each element (node) of a list is comprising of two items - the data and a reference to the next node. The last node has a reference to null. The entry point into a linked list is called the head of the list.

Stacks

A stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). Mainly the following three basic operations are performed in the stack: Push, Pop, and Peek or Top.

Queues

A queue is a type of linear data structure that follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good example of a queue is any queue of consumers for a resource where the consumer that came first is served first.

Non-Linear Data Structures

Non-linear data structures are those in which data elements are not arranged sequentially or linearly. Data elements are connected hierarchically and every item has some relationship with others. The basic types of non-linear data structures include:

Trees

A tree is a widely used abstract data type (ADT) that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes.

Graphs

A graph data structure consists of a finite (and possibly mutable) set of vertices or nodes or points, together with a set of unordered pairs of these vertices for an undirected graph or a set of ordered pairs for a directed graph.

Hash Tables

A hash table, also known as a hash map, is a data structure that implements an associative array abstract data type, a structure that can map keys to values. A hash table uses a hash function to compute an index into an array of buckets or slots, from which the desired value can be found.

A photo of a table with keys and corresponding values, representing a hash table.
A photo of a table with keys and corresponding values, representing a hash table.

See Also