Skip to main content

What are the main types of data structures?

The main types of data structures are usually divided into several groups:


1. Linear structures

Elements go one after another, in sequence.

  • Array - fixed size, fast access by index.
  • Linked List - fast insertions and deletions, but slow access by index.
  • Stack - LIFO principle: last in, first out.
  • Queue - FIFO principle: first in, first out.
  • Deque - insertion and deletion on both ends.

2. Hash structures

Store key-value pairs and give fast access by key.

  • Hash Table / Hash Map

3. Trees and hierarchical structures

Suited for nested data and fast search.

  • Binary Search Tree (BST)
  • Balanced trees (AVL, Red-Black Tree)
  • Heaps - for priorities and priority queues
  • Trie - for words and prefixes

4. Graphs

For modeling networks: cities, social networks, routes, connections between objects.

  • Directed and undirected graphs
  • Weighted and unweighted

5. Sets

Store unique elements, convenient for checking "belongs/does not belong".

  • Set / HashSet / TreeSet

6. Additional structures

Used to speed up search and access.

  • Priority queue
  • Skip List
  • Bloom Filter
  • Segment Tree, Fenwick Tree - for working with ranges

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.