A quick reference of the big O costs and core properties of every data structure.
Stores things in order. Has quick lookups by index.
An array that automatically grows as you add more items.
Also stores things in order. Faster insertions and deletions than arrays, but slower lookups (you have to "walk down" the whole list).
Like the line outside a busy restaurant. "First come, first served."
Like a stack of dirty plates in the sink. The first one you take off the top is the last one you put down.
Like an array, except instead of indices you can set arbitrary keys for each value.
Good for storing hierarchies. Each node can have "child" nodes.
Everything in the left subtree is smaller than the current node, everything in the right subtree is larger. lookups, but only if the tree is balanced!
Good for storing networks, geography, social relationships, etc.
Stores a set of strings in a big tree of characters. Good for lookups by prefix. Sometimes saves space.
A binary tree where the smallest value is always at the top. Use it to implement a priority queue.
A queue where items are ordered by priority.
A constant-space bitmap that lets you quickly check whether or not an item is in a set. Can give false positives.
Lets you quickly identify which item hasn't been used for the longest amount of time.
In this free email course, I'll teach you the right way of thinking for breaking down tricky algorithmic coding questions.
No CS degree necessary.
You're in!
Want more coding interview help?
Check out interviewcake.com for more advice, guides, and practice questions.
Copyright © 2024 Cake Labs, Inc. All rights reserved. 21750 Hardy Oak Blvd Ste 104 PMB 82632 , San Antonio , TX US 78258 (862) 294-2956
“ Interview Cake takes the cake when it comes to interview prep. After studying for a little over 2 months, I finally cracked a technical interview and got an offer from my dream financial company! Thanks for all the help! — Fuad