Data Structures Cheat Sheet 2026

The 30 highest-yield Data Structures facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.

60 questions
90 min time limit
70.00% to pass
  1. Which data structure can be implemented using two linked lists to support O(1) push, pop, and min operations? Min-stack
  2. Which sorting algorithm has the best worst-case time complexity? Merge sort
  3. In a 2D array stored in row-major order, which access pattern is more cache-friendly? Row-by-row access
  4. Which approach finds the kth largest element in an unsorted array in average O(n) time? Quickselect algorithm
  5. Which algorithm uses a stack to evaluate postfix (Reverse Polish Notation) expressions? Push numbers, pop two operands when an operator is found, push result
  6. Which of the following uses the first-in, first-out (FIFO) method? Queue
  7. What is the time complexity of deleting a node from a singly linked list given only a pointer to that node (not the previous)? O(1) by copying successor data
  8. Which problem can be solved optimally using a hash map to track complement pairs? Two Sum: finding two indices that add to a target
  9. What is the space complexity of storing a string of length n? O(n)
  10. What triggers rehashing in a hash table? When the load factor exceeds a threshold (commonly 0.75)
  11. Two-dimensional arrays are also referred to as both A & B
  12. Which tree traversal visits nodes in ascending order for a Binary Search Tree? In-order
  13. Which of the following is NOT a valid graph traversal algorithm? Inorder Traversal
  14. What is the time complexity of finding an element in a sorted rotated array using binary search? O(log n)
  15. What is a collision in a hash table? Two different keys hashing to the same bucket index
  16. Why is the worst-case time complexity of hash table lookup O(n)? All keys hash to the same bucket, creating a single chain of length n
  17. Which string algorithm preprocesses a failure function to skip redundant comparisons? KMP (Knuth-Morris-Pratt)
  18. When determining the efficiency of an algorithm, the time factor is Counting the number of key operations
  19. Because aposterior analysis is more accurate than apriori analysis, it is it assumes all other facets to be dynamic
  20. What is the time complexity of the push and pop operations on a stack? O(1) for both
  21. What is the key property of a sorted rotated array that enables binary search on it? At least one half of the array is always sorted
  22. What does it mean for a binary tree to be height-balanced? The height difference between left and right subtrees is at most 1 for every node
  23. How can a queue be implemented using two stacks with amortized O(1) enqueue and dequeue? Enqueue to stack1; dequeue pops from stack2, transferring from stack1 when stack2 is empty
  24. Which hash function property ensures similar inputs produce very different outputs? Avalanche effect
  25. What is an LRU Cache and which data structures implement it in O(1) for both get and put? LRU cache using a doubly linked list and hash map
  26. How can two sorted linked lists be merged in O(m+n) time? Compare heads iteratively and link the smaller node
  27. What is the time complexity of inserting a node at the beginning of a singly linked list? O(1)
  28. What is the time complexity of insertion into a binary min-heap (underlying a priority queue)? O(log n)
  29. How does partitioning a linked list around a value x (like in quicksort) work? Maintain two separate lists for = x nodes, then concatenate
  30. What is the Fenwick tree (Binary Indexed Tree) optimized for? Prefix sum queries and point updates in O(log n) with less memory than a segment tree