Top 10 Data Structures Every Coding Interview Candidate Must Know

A beginner friendly tour of the ten data structures that show up in 90 percent of coding interviews, with when to reach for each one, common operations, complexity, and the patterns that hire candidates.

12 min read

If you only have a few weeks to prepare for a coding interview, you do not need to learn every data structure ever invented. About ten of them carry the entire load in nearly every beginner and new-grad interview in 2026. Once you can recognise which one fits a given problem, half the battle is already won.

This article walks through those ten in plain language. For each you get a one-line mental model, the operations and complexity to know cold, and the kinds of problems where it shows up. Pair this with the coding-interview prep guide and you have a working shortlist for any LeetCode-style screen.

How to Use This Guide

For each data structure, ask three questions:

  1. What is the mental model? A one-sentence picture in your head.
  2. What are the time complexities? Memorise these — they are 30% of the points in any complexity discussion.
  3. What pattern does it suggest? Recognising "I see X → reach for Y" is the entire point.

If you can answer those three questions for all ten structures below, you can name the right tool for ~90% of beginner problems within the first minute of reading them.

1. Array (Dynamic Array)

The default. Contiguous memory, indexed access in O(1). In Python it is list, in Java ArrayList, in C++ std::vector.

  • Operations: indexed read/write O(1); push/pop end amortised O(1); insert/remove middle O(n).
  • When to reach: when order matters and you mostly read by index.
  • Patterns: two pointers, sliding window, prefix sums.

Most string problems are array problems in disguise.

2. Hash Map / Hash Set

The other default. Average O(1) lookup, insert, and delete. Python dict / set, Java HashMap / HashSet, C++ unordered_map.

  • Operations: get / put / delete O(1) average, O(n) worst case (collisions).
  • When to reach: counting frequencies, deduplicating, "have I seen this before", index-by-value lookups.
  • Patterns: complement search (Two Sum), frequency counting (anagram problems), set membership.

If a brute-force solution is O(n²) and the inner loop is "search for something", a hash map almost always brings it to O(n).

3. Linked List

A chain of nodes, each pointing to the next. See linked list basics.

  • Operations: O(1) insert/delete given the node; O(n) random access.
  • When to reach: when interview problem statement says "linked list" — outside that, rarely.
  • Patterns: slow / fast pointers (cycle detection, midpoint, kth from end), in-place reversal.

Practising reverse a linked list and cycle detection covers ~70% of linked-list interview questions.

4. Stack

LIFO sequence — push and pop on the top. See stacks and queues.

  • Operations: push / pop / peek O(1).
  • When to reach: matching brackets, expression evaluation, "next greater element", DFS without recursion, undo.
  • Patterns: monotonic stack (next greater / smaller), bracket matching, depth-first traversal.

If the problem mentions "most recent" or "nested", think stack first.

5. Queue / Deque

FIFO sequence — enqueue at back, dequeue at front. The deque allows both ends. Python collections.deque, Java ArrayDeque.

  • Operations: enqueue / dequeue O(1); both ends for deque.
  • When to reach: BFS, sliding window where the window shrinks from one end, level-order traversal.
  • Patterns: BFS, monotonic deque (sliding window max), task scheduling.

The deque is the Swiss-army knife — use it as your default queue and stack in production code.

6. Tree (Binary Tree / BST)

Hierarchical data: each node has up to two children. See binary trees explained.

  • Operations on BST: search / insert / delete O(log n) if balanced, O(n) if skewed.
  • When to reach: hierarchical data, ordered data with range queries, problem statements that draw a tree.
  • Patterns: pre/in/post-order traversal, level order with a queue, recursion (base/recurse/combine), DFS for subtree problems.

The four traversals plus the base/recurse/combine recursive shape solve almost every beginner tree problem.

7. Heap (Priority Queue)

A specialised tree that gives O(log n) insert and O(log n) extract-min (or extract-max). Python heapq, Java PriorityQueue, C++ priority_queue.

  • Operations: push O(log n); pop O(log n); peek O(1); build from array O(n).
  • When to reach: "top K", "Kth largest / smallest", running median, scheduling by priority.
  • Patterns: top-K elements (k-sized heap), Dijkstra, merge K sorted lists.

If you see "top K" or "smallest / largest so far", reach for a heap before thinking about sorting.

8. Graph

Vertices and edges. Usually represented as an adjacency list (dictionary of lists). See BFS vs DFS.

  • Operations: BFS and DFS each in O(V + E).
  • When to reach: networks, dependencies, paths, connectivity, anything with "neighbours".
  • Patterns: BFS for shortest unweighted path, DFS for connectivity / topological sort / cycle detection.

Most "grid" problems are graph problems where each cell is a vertex with 4 (or 8) neighbours.

9. Trie (Prefix Tree)

A tree where each node represents one character, used for prefix-based queries.

  • Operations: insert / search / prefix-search O(L), where L is the word length.
  • When to reach: autocomplete, spell-check, "find all words with prefix X", word-game solvers.
  • Patterns: prefix matching, dictionary lookup, backtracking over a word grid (Boggle, Word Search II).

Tries appear less often than the others on this list but when they appear, no other structure works as well.

10. Union-Find (Disjoint Set Union)

A structure tracking which elements belong to which group; supports near-O(1) union and find.

  • Operations: find(x), union(a, b) each effectively O(α(n)) ≈ O(1).
  • When to reach: "are these two connected?", grouping by equivalence, Kruskal's MST, accounts merge.
  • Patterns: connected components, cycle detection in undirected graphs, gradual connectivity (offline queries).

Union-Find is the most under-appreciated structure in beginner study plans — when it fits, it makes problems trivial that would otherwise need careful BFS/DFS bookkeeping.

A Decision Cheat Sheet

Hint in the problemReach for
"First / smallest / largest K"Heap
"Have I seen X before?" / "count occurrences"Hash map / set
"Most recent" / "nested" / "matching"Stack
"Layer by layer" / "shortest unweighted path"Queue (BFS)
"All paths" / "all combinations"Recursion / backtracking
"Are these two connected?" / "groups"Union-Find
"Prefix" / "starts with" / "autocomplete"Trie
"Sorted" / "ordered range queries"Sorted array + binary search, or BST

Pin this table to your wall during prep. The single skill that separates strong candidates is reading a problem and immediately knowing which two or three structures to consider.

Common Mistakes Beginners Make

  • Memorising operations without practising. Knowing "heap is O(log n) push" does not help if you have never coded one in an interview setting.
  • Defaulting to arrays for everything. Many problems become trivial with a hash map or heap that look painful in raw arrays.
  • Skipping union-find and tries. They unlock a class of medium problems with almost no code.
  • Confusing average and worst case. Hash maps are O(n) worst case — say "average O(1)" in interviews.
  • Forgetting the standard library. Reinventing a heap when heapq exists wastes interview minutes.

Quick Reference

  • 10 structures cover ~90% of beginner coding interviews.
  • Memorise: array, hash map, linked list, stack, queue/deque, tree, heap, graph, trie, union-find.
  • Match each to the patterns it solves; pattern recognition is the interview skill.
  • Use your language's standard library — heapq, collections.deque, Counter in Python.
  • Always state average vs worst case explicitly.
  • Pair this guide with BFS vs DFS and binary search for the algorithmic complement.
Rune AI

Rune AI

Key Insights

  • 10 structures (array, hash, linked list, stack, queue, tree, heap, graph, trie, union-find) cover ~90% of interviews.
  • Memorise mental model + complexity + pattern for each.
  • Pattern recognition beats raw problem count.
  • Use the standard library; avoid reinventing core structures during interviews.
  • Pair with mocks (week 5+) to convert recognition into fluency.
RunePowered by Rune AI

Frequently Asked Questions

Do I need to know red-black trees and AVL trees?

No. Know that BSTs can be balanced and that the standard library uses balanced variants. Implementation details are not asked at the beginner level.

How important are tries vs heaps?

Heaps appear far more often. Learn them first; tries can be picked up in a weekend.

What about graphs with weights?

Beginner interviews mostly use unweighted graphs (BFS suffices). Dijkstra is a useful bonus but rarely required for new grads.

Is union-find worth learning if I am crunched for time?

Yes — the implementation is ~15 lines and unlocks a category of problems that have no easy alternative.

Do I need to implement these from scratch?

For interviews, knowing how they work conceptually plus how to use the library is enough. Hand-implementing a heap or trie is good extra credit.

Conclusion

Ten data structures cover most beginner coding interviews in 2026. The skill that separates strong candidates is recognition: reading a problem and naming the structure within sixty seconds. Internalise the cheat sheet above, practise on a balanced set of problems for each structure, and you will arrive at interviews with a clear, calm toolkit instead of a panic.