Data Structures
Overview
A data structure is a way of organizing data so the operations you need on it are efficient. In coding interviews (Blind 75, NeetCode 150, Cracking the Coding Interview, LeetCode company tags), a small set of structures covers roughly 90% of problems. This topic is a reference for that set: what each structure is, how it’s typically implemented, the time complexity of its core operations, and the canonical problems it solves.
The top ten
- Arrays
- Strings
- Hash Tables
- Linked Lists
- Stacks
- Queues
- Binary Trees & BSTs
- Heaps / Priority Queues
- Graphs
- Tries
How each subtopic is organized
Every subtopic follows a consistent structure so they’re easy to scan:
- Intro, what it is and why it exists
- In-depth description, how it’s typically implemented and the key invariants
- Time complexity, average- and worst-case for the main operations
- Common uses in DSA, five interview-relevant problem patterns it unlocks
Picking the right structure
A rough decision flow:
- Need O(1) lookup by value? → Hash Table
- Need order preserved and random access? → Array
- Need FIFO (breadth, levels, streams)? → Queue
- Need LIFO (nesting, backtracking, matching)? → Stack
- Need top-K or always-min/max? → Heap
- Need ordered map / in-order iteration? → Binary Search Tree
- Need hierarchical data or “explore from a node”? → Tree or Graph
- Need fast prefix queries? → Trie
- Need O(1) insert/delete at a known node? → Linked List (usually as part of a composite like LRU)
References
- Cracking the Coding Interview, Gayle Laakmann McDowell
- Elements of Programming Interviews, Aziz, Lee, Prakash
- Introduction to Algorithms (CLRS), Cormen, Leiserson, Rivest, Stein
- NeetCode 150 Roadmap
- Blind 75 list
- Big-O Cheat Sheet
Related posts
- Data structure complexity cheat sheet, the operations and big-O for every structure on this page, with Python-specific gotchas (
list.pop(0)is O(n), etc.). - Common algorithms cheat sheet, Dijkstra, Kahn, Kruskal, Tarjan, Floyd, KMP, quickselect, Union-Find, with canonical implementations and decision matrix.
Related topics
- LeetCode 150, problems organized by the patterns these structures unlock.
- Functional core, imperative shell, how immutability shapes architecture.