Data Structure Complexity Analysis

Time and space complexity analysis of common data structures: Array, Linked List, Binary Search Tree, Hash Table, Heap, and Graph with Big-O notation.

  • JSON6,501 B
  • YAML3,855 B · −41%
  • TOON2,365 B · −64%

Time and space complexity of basic operations (access, search, insertion, deletion) for the core data structures: arrays, linked lists, binary search trees, hash tables, heaps and graphs, extended with stacks, queues, dynamic arrays, balanced trees, tries and skip lists.

Use it when

  • You need a quick comparison of operation costs across data structures.
  • You are choosing a structure for a given access pattern.

Watch out for

  • Values are typical average-case figures; worst cases can be worse (a hash table with many collisions, an unbalanced tree).
  • For linked-list insertion and deletion, O(1) assumes you already hold a reference to the node.

The data

Structures

NameAccessSearchInsertionDeletionSpace
ArrayO(1)O(n)O(n)O(n)O(n)
Linked ListO(n)O(n)O(1)O(1)O(n)
Binary Search TreeO(log n)O(log n)O(log n)O(log n)O(n)
Hash TableN/AO(1)O(1)O(1)O(n)
HeapO(1) maxO(n)O(log n)O(log n)O(n)
Graph (Adjacency List)O(1)O(V+E)O(1)O(V+E)O(V+E)
StackO(n)O(n)O(1)O(1)O(n)
QueueO(n)O(n)O(1)O(1)O(n)
Dynamic ArrayO(1)O(n)O(n) (amortized O(1) at the end)O(n)O(n)
Doubly Linked ListO(n)O(n)O(1)O(1)O(n)
AVL TreeO(log n)O(log n)O(log n)O(log n)O(n)
Red-Black TreeO(log n)O(log n)O(log n)O(log n)O(n)
B-TreeO(log n)O(log n)O(log n)O(log n)O(n)
TrieN/AO(m)O(m)O(m)O(total key length)
Skip ListO(log n) expectedO(log n) expectedO(log n) expectedO(log n) expectedO(n)

Fields

The shape of this dataset, read from the data itself: every column, its type and a real value. Agents can use this to plan a query without fetching the whole document.

SectionFieldTypeExample
structuresnamestringArray
structuresaccessstringO(1)
structuressearchstringO(n)
structuresinsertionstringO(n)
structuresdeletionstringO(n)
structuresspacestringO(n)

Fetch the same bytes

The static files contain the same reference rows as the API, with no API rate limit. Live metadata, such as view counts, may differ. Use the API for content negotiation; use the static files for a cacheable snapshot.

curl "https://yjtoon.com/api/dataset/complexity-analysis?format=toon"
const res = await fetch(
  "https://yjtoon.com/static-data/dataset/complexity-analysis.toon"
);
const toon = await res.text();

Rate limit: 120 requests per minute per IP, no key and no signup. API reference →

Topics

  • algorithms
  • complexity
  • big-o
  • data structures

Search the library

Search by a topic, title, or keyword.

Start with a collection

Browse all 205 datasets