How to work through this deck

Use these data structures and algorithms flashcards as a retrieval drill, not as a page to reread. For each card, read the question, say or think of a precise answer, then reveal the answer. Grade it Again if you could not retrieve the fact, Hard if you got it with effort or missed a condition, Good if you answered correctly, and Easy if it came immediately and accurately. The MySummaries deck view shows the first card answered and ready to grade; the remaining cards form the same session.

Keep answers short but qualified. “Hash tables are O(1)” is not a complete answer: the useful version says average-case lookup is O(1), while worst-case lookup is O(n). Those qualifiers are often where understanding shows. If you miss one, do not memorise only the symbol. Explain what operation is being counted and which assumption supports the bound.

A MySummaries deck on this topic looks like this:

Cards — Data Structures and Algorithms — Foundations18 due

What is the worst-case time complexity of binary search on a sorted array?

O(log n), because each comparison halves the remaining search interval.

All 18 cards
What is the worst-case time complexity of binary search on a sorted array?O(log n), because each comparison halves the remaining search interval.
What condition must hold before binary search can be used on an array?The array must be sorted according to the order used by the search.
What is the worst-case time complexity of searching an unsorted array?O(n), because the target may be absent or in the final position.
What are the average and worst-case lookup complexities of a hash table?Average O(1) under a suitable hash distribution and controlled load factor; worst-case O(n) with many collisions.
What does a collision mean in a hash table?Two different keys map to the same table index.
What is the worst-case time complexity of inserting into a binary heap?O(log n), because the new element may sift from a leaf to the root.
What is the time complexity of reading the minimum from a min-heap?O(1); the minimum is at the root.
What is the worst-case search complexity in a balanced binary search tree?O(log n), because the tree height is logarithmic in the number of nodes.
What is the worst-case search complexity in a completely skewed binary search tree?O(n); its height can be n − 1, so search may visit every node.
What is the worst-case time complexity of merge sort?O(n log n). It divides the input into logarithmic levels and merges n elements per level.
What is merge sort’s auxiliary space complexity on arrays in its usual implementation?O(n) additional space for merging.
What is quicksort’s worst-case time complexity?O(n²), when partitions are repeatedly very unbalanced.
What is the worst-case time complexity of insertion sort?O(n²), such as when sorting a reverse-ordered array.
Which traversal finds shortest-path distances in an unweighted graph?Breadth-first search (BFS). It explores vertices in layers of edge distance.
Which traversal uses a stack or recursion to explore a graph deeply before backtracking?Depth-first search (DFS).
What is the time complexity of BFS using an adjacency list?O(V + E), where V is the number of vertices and E is the number of edges.
What is the worst-case time complexity of accessing an array element by index?O(1), assuming the index is valid and the array provides direct indexed access.
What does amortised O(1) append mean for a dynamic array?Across a sequence of appends, the average cost per append is O(1), even though a resize can make an individual append O(n).

That is a MySummaries deck, filled with data structures and algorithms material. Yours is written from your own notes. Start free

Review the facts that need conditions

The cards cover common structures and algorithms, but the point of the drill is to retrieve the right fact with its conditions attached. After a session, sort your misses into three kinds: a fact you did not know, a condition you forgot, or a complexity you confused with another operation. For example, heap insertion is O(log n), but reading its minimum is O(1); mixing those up is an operation-mapping error rather than a general failure to understand heaps.

When a card feels difficult, answer it again in a complete sentence. For complexity questions, name the input size and operation. For graph questions, state whether the graph is unweighted and what representation the bound assumes. For hashing, retain the average-versus-worst distinction. This makes a short answer useful beyond the exact wording on the card.

Here is the Must not miss core these cards were cut from:

Key pointsData Structures and Algorithms — Foundations
Binary search requires sorted data and runs in O(log n); an unsorted-array search is O(n).
Hash-table lookup is average O(1) with a suitable distribution and controlled load factor, but worst-case O(n) with collisions.
A min-heap exposes its minimum in O(1); insertion and removal are O(log n).
Merge sort is O(n log n) in the worst case and usually needs O(n) auxiliary array space; quicksort can be O(n²) in the worst case.
BFS finds shortest-path distances by edge count in an unweighted graph; with adjacency lists, BFS and DFS run in O(V + E).

Turn repeated misses into a repair task

Do not respond to every missed card by rereading an entire chapter. Identify the missing distinction and write a one-line correction. If you missed a heap card, compare access to the root with insertion or removal. If you missed BFS, say why the layer-by-layer order gives shortest paths when every edge has equal cost, and note that this claim does not apply unchanged to arbitrary weighted graphs. Then retry the card later rather than immediately counting recognition as mastery.

Repeated misses deserve a focused prompt that tests the distinction directly. For example, if “balanced tree search is logarithmic” keeps being confused with a skewed tree, the repair question should ask what happens when the height grows to n − 1. The remediation tray holds that kind of targeted follow-up:

Remediation tray

You lost this distinction twice: a binary search tree has O(log n) search only when its height is logarithmic. What is the worst-case search time when the tree is skewed to height n − 1, and why?

Add cardDismiss

A repeatable review routine

Work through a manageable group of cards, then pause to explain two or three answers without looking. That second step checks whether you can connect a fact to its reason: binary search halves a sorted search interval; BFS advances in edge-distance layers; a dynamic array’s occasional resize is spread across many appends in the amortised analysis.

For a missed card, use this sequence:

  1. State the answer and its condition in your own words.
  2. Give a small example or counterexample, such as a skewed tree or a hash collision.
  3. Grade it honestly, then revisit it when it is due.

Once the basic deck is reliable, add cards from the data structures and algorithms you are currently studying. Keep each card to one decision or fact: separate a traversal’s purpose from its complexity, and separate a sorting algorithm’s time from its extra-space cost. That way, a wrong answer points to something specific you can repair.

How MySummaries helps

MySummaries lets you build a revision board from your own course material, then generate flashcards from it and schedule reviews with spaced repetition. For this subject, that means you can add your lecture notes on trees, sorting or graph algorithms and turn the definitions and complexity distinctions you actually need into a deck. Start at MySummaries.