Fun with Learning Technology
LearnCoursesQuestionsTracksToolsNewsExplorePractice
Fun with Learning Technology

A new problem, explained clearly, every day.

Subscribe
Learn
  • Lessons
  • Topics
  • News
  • Tools
  • Courses
  • Career tracks
  • Everything
Site
  • About
  • Contact
  • Support
  • Privacy
  • Terms
Get the daily one

One email per new problem. No spam.

Request a tutorial

Requests shape what gets made next.

© 2026 Fun with Learning TechnologyRSS
← All tools

Big-O Complexity Reference

Time and space complexity for the data structures and sorting algorithms interviewers actually ask about.

NameAccessSearchInsertDelete
list (dynamic array)
append is O(1) amortized; insert/pop at index 0 is O(n)
O(1)O(n)O(n)O(n)
dict / hash map
O(n) worst case on pathological collisions
—O(1)O(1)O(1)
set
same hashing behaviour as dict
—O(1)O(1)O(1)
deque
O(1) at both ends — the reason to prefer it over list for queues
O(n)O(n)O(1)O(1)
heap (binary)
O(1) access is peek at the root only
O(1)O(n)O(log n)O(log n)
balanced BST
not built into Python — use `sortedcontainers`
O(log n)O(log n)O(log n)O(log n)
singly linked list
insert/delete O(1) only once you hold the node
O(n)O(n)O(1)O(1)
string
immutable — concatenation in a loop is O(n²)
O(1)O(n)O(n)O(n)

Complexities are for the average case unless the column says otherwise. When an interviewer asks “can you do better?”, they usually mean: can you trade space for time by adding a hash map?

How to use it

  1. Pick the Data structures or Sorting algorithms tab.
  2. Find your structure or algorithm in the left column.
  3. Read across for access, search, insert and delete costs — the notes call out the cases that differ.