Data Structure Reference

Compare data structures side by side with time complexity, space complexity, and use cases.

37.0Kuses
8.9/10(74)
StructureAccessSearchInsertDeleteSpace
ArrayO(1)O(n)O(n)O(n)O(n)
Dynamic ArrayO(1)O(n)O(1)*O(n)O(n)
Linked ListO(n)O(n)O(1)O(1)O(n)
Doubly Linked ListO(n)O(n)O(1)O(1)O(n)
StackO(n)O(n)O(1)O(1)O(n)
QueueO(n)O(n)O(1)O(1)O(n)
Hash TableN/AO(1)*O(1)*O(1)*O(n)
BSTO(log n)*O(log n)*O(log n)*O(log n)*O(n)
AVL TreeO(log n)O(log n)O(log n)O(log n)O(n)
HeapO(n)O(n)O(log n)O(log n)O(n)
TrieO(m)O(m)O(m)O(m)O(n*m)
Graph (Adj. List)O(V+E)O(V+E)O(1)O(E)O(V+E)
* = amortized average case. m = key length (for Trie). V = vertices, E = edges (for Graph).

Use Cases

Array
Random access, iteration, cache-friendly
Dynamic Array
Resizable arrays, lists, stacks
Linked List
Frequent insertions/deletions, queues
Doubly Linked List
Two-way traversal, LRU cache
Stack
LIFO, undo, recursion, parsing
Queue
FIFO, BFS, task scheduling
Hash Table
Fast lookup, caching, counting
BST
Sorted data, range queries
AVL Tree
Balanced BST, databases
Heap
Priority queues, scheduling
Trie
Autocomplete, spell check, IP routing
Graph (Adj. List)
Networks, social graphs, maps

About

A comprehensive comparison chart of common data structures with average-case time complexities for key operations. Asterisk (*) indicates amortized or average-case values.

⚡ Pro OptionsSponsored

Some links on this page are affiliate links. If you click and make a purchase, we may earn a commission at no extra cost to you.

Recommended Products

Ad

Affiliate Disclosure: As an Amazon Associate, ToolBird earns from qualifying purchases. Links above are affiliate links — if you buy through them, we may earn a small commission at no extra cost to you.

Disclaimer: This tool is provided as-is for informational and educational purposes only.

ToolBird Assistant

Find the right tool instantly

Hey! I'm ToolBird Assistant. Tell me what you need and I'll find the right tool for you.