250 Data Structures & Algorithms Flashcards for Memly

In this subject, speed comes from knowing the tradeoff before you touch the code.

250 cards

Sign up free and add it

The deck is added automatically once you finish signing up.

Nothing here is generated by AI, so the free plan is enough to add it.

See 30 sample cards

Showing a 30-card sample of 250.

FrontBack
Big-O notationMeaning: An asymptotic upper bound used to cap how fast running time or memory can grow for large inputs. Complexity: Expresses time O(f(n)) or space O(g(n)). It does not claim the bound is tight. Watch for: Often confused with Big-Theta. A function can be O(f(n)) and still be much smaller.
Telescoping recurrenceMeaning: A recurrence solved by expanding terms until most parts cancel, used to turn recursive cost into an explicit sum. Complexity: For T(n)=T(n-1)+f(n), time is often O(the sum of f(i) for i from 1 to n). Space is O(n) with direct recursion or O(1) if rewritten iteratively. Watch for: It is not the right tool for branching recurrences like T(n)=2T(n/2)+n, which do not collapse into one chain.
ArrayMeaning: A fixed-size contiguous sequence used when you need O(1) indexing and compact storage. Complexity: Index and update are O(1). Search is O(n). Insert or delete away from the end is O(n). Space is O(n). Watch for: Middle edits shift many elements. O(1) access does not mean O(1) search.
Prefix sum arrayMeaning: Stores cumulative totals so a range sum can be answered from two lookups, useful for many static interval queries. Complexity: Build O(n) time and O(n) space. Range sum query O(1). Single update O(n) if prefixes stay explicit. Watch for: Best for mostly read-only data. It is often confused with a difference array, which optimizes range updates instead.
Floyd's cycle detectionMeaning: Uses slow and fast pointers to detect a cycle in a linked structure without extra memory. Complexity: Time O(n). Extra space O(1). Watch for: It detects a cycle and can locate its entry, but it is not the same as reversing a list or marking visited nodes.
RehashingMeaning: Rebuilds a hash table at a new size and reinserts keys to restore low collision cost as occupancy changes. Complexity: A resize step is O(n) time. Insert is O(1) average amortized and O(n) worst. Space O(n). Watch for: Cached bucket indexes become invalid after resize. A full rebuild can cause latency spikes.
Complete binary treeMeaning: A binary tree whose last level is filled left to right after all higher levels, which makes it efficient to store in an array. Complexity: With n nodes, height is O(log n), traversal is O(n), and storage is O(n). Parent and child index jumps are O(1) in an array layout. Watch for: Do not confuse complete with full or perfect. Missing nodes may appear only at the far right of the last level.
Binary heapMeaning: A complete binary tree with heap order, usually stored in an array, used to implement a fast priority queue. Complexity: Peek root is O(1). Insert and extract root are O(log n). Building from n items is O(n). Space is O(n). Watch for: Only the root is globally smallest or largest. Searching for an arbitrary key is O(n), not O(log n).
TrieMeaning: A tree over characters where each root-to-node path is a prefix, used for dictionaries, autocomplete and prefix tests. Complexity: Search, insert and delete are O(m) for key length m. Space is O(number of nodes), which can be much larger than storing the keys alone. Watch for: Memory use depends heavily on alphabet size and sparsity. It does not keep keys in BST order.
Threaded binary treeMeaning: A binary tree that replaces null child links with inorder predecessor or successor links so traversal needs no stack. Complexity: Traversal is O(n) time and O(1) extra space. Search, insert, and delete are O(h) time and must maintain threads. Watch for: Updates are easy to get wrong. Do not confuse thread links with parent pointers.
Binomial heapMeaning: A meldable heap built from binomial trees, useful when unioning priority queues efficiently matters. Complexity: Insert, meld, extract-min, decrease-key, and delete are O(log n) worst case. Find-min is O(log n) or O(1) with a min pointer. Space O(n). Watch for: It often has higher constants than a binary heap. The structure is a forest rather than one complete tree.
Aho-Corasick automatonMeaning: A trie with failure links for finding many exact patterns at once while scanning the text one pass. Complexity: Build is O(total pattern length) time and space. Search is O(text length plus matches). Watch for: It is for exact multi-pattern search, not approximate matching. Large alphabets raise constants.
QuickselectMeaning: Quickselect partitions like quicksort but recurses into one side, making it useful for finding the kth smallest item. Complexity: Average O(n). Worst O(n^2). Extra space O(log n) average and O(n) worst from recursion. Watch for: Bad pivots and many duplicates can hurt. It is often confused with fully sorting the array.
Bubble sortMeaning: A comparison sort that repeatedly swaps adjacent out-of-order items and is used mainly for teaching or tiny nearly sorted inputs. Complexity: Average and worst time O(n^2). Best time O(n) with early exit, otherwise O(n^2). Space O(1). Watch for: Without a swapped flag, sorted input does not improve. It is often confused with insertion sort.
Jump searchMeaning: A search algorithm for sorted arrays that jumps ahead by blocks and then scans linearly within the right block. Complexity: Average and worst time O(√n). Space O(1). Watch for: It needs a sorted array and random access. It is slower than binary search asymptotically.
Floyd-Rivest algorithmMeaning: A randomized selection algorithm that uses sampling to find the kth smallest element faster in practice than plain quickselect. Complexity: Expected time O(n). Worst time O(n^2). Space O(log n) with recursion. Watch for: It has no worst-case linear guarantee. It is often confused with median of medians.
Adjacency listMeaning: Stores, for each vertex, the list of outgoing neighbors and is used for sparse graphs and fast neighbor traversal. Complexity: Build O(V+E). Edge lookup O(deg(u)) worst. Neighbor iteration O(deg(u)). Space O(V+E). Watch for: Dense graphs make it less cache friendly than a matrix. It is often confused with an edge list.
Breadth-first searchMeaning: Explores vertices by increasing distance from a start node and is used for reachability and shortest paths in unweighted graphs. Complexity: O(V+E) time with adjacency lists, O(V^2) with a matrix. Space O(V). Watch for: Weighted edges break shortest-path correctness. Mark vertices visited when enqueuing.
Strongly connected componentMeaning: A maximal set of vertices in a directed graph where every vertex can reach every other and is used to compress cycles. Complexity: All SCCs can be found in O(V+E) time and O(V) space. Watch for: This is for directed graphs. It is not the same as an undirected connected component.
Directed acyclic graphMeaning: A directed graph with no directed cycles. It models dependencies and supports linear-time ordering and dynamic programs. Complexity: Storage is O(V+E) with lists or O(V^2) with a matrix. Testing acyclicity or ordering takes O(V+E) time and O(V) extra space. Watch for: Any directed cycle breaks it. Do not confuse a DAG with a tree, which is connected and acyclic in a different sense.
Bidirectional searchMeaning: A search that expands from source and target at the same time. It can cut the search depth for unweighted shortest paths. Complexity: With branching factor b and distance d, balanced cases use O(b^(d/2)) time and space. Worst case remains O(b^d). Watch for: It needs a known target and a way to search backward or generate reverse neighbors.
0-1 BFSMeaning: A shortest-path algorithm for graphs whose edge weights are only 0 or 1. It uses a deque instead of a priority queue. Complexity: Time is O(V+E). Space is O(V). Watch for: Any edge weight outside {0,1} breaks its guarantee. Do not replace general weighted shortest paths with it.
BridgeMeaning: An edge whose removal increases the number of connected components of an undirected graph. It marks a single point of failure. Complexity: All bridges can be found by one DFS with low-link values in O(V+E) time and O(V) extra space. Watch for: In multigraphs parallel edges can prevent an edge from being a bridge even if it looks critical.
Closest pair of pointsMeaning: A divide-and-conquer algorithm for the nearest pair in the plane. It is used to beat the quadratic all-pairs check. Complexity: Time O(n log n). Space O(n). Watch for: The strip combine step must examine only nearby points. Confused with the O(n^2) brute-force method.
Activity selection algorithmMeaning: A greedy scheduler that repeatedly picks the compatible activity with earliest finish time. It is used to maximize the number of non-overlapping activities. Complexity: Time O(n log n) with sorting, or O(n) after finish-time sorting. Space O(1) extra after sorting. Watch for: It maximizes count, not total weight. Confused with weighted interval scheduling, which needs dynamic programming.
BacktrackingMeaning: A depth-first search technique that builds a candidate step by step and abandons partial solutions that violate constraints. It is used for exact combinatorial search. Complexity: Worst-case time is often exponential, commonly O(b^d). Space O(d) for recursion depth. Watch for: Weak pruning causes blowups. Confused with dynamic programming, which reuses overlapping subproblems.
PTASMeaning: A scheme that, for any fixed epsilon > 0, returns a solution arbitrarily close to optimal in polynomial time. It is used to trade accuracy for speed. Complexity: For fixed epsilon, time is polynomial in n, often O(n^(f(1/epsilon))). Space is polynomial. Watch for: Confused with FPTAS, which is also polynomial in 1/epsilon. A PTAS may still be impractical for small epsilon.
Fractional knapsackMeaning: A greedy optimization problem where items can be split, so taking highest value density first gives the maximum value. Complexity: Time O(n log n) for sorting by value density. Extra space is O(1) beyond the sort or O(n) with copied data. Watch for: The greedy choice fails for the 0-1 version where items are indivisible. It is confused with 0-1 knapsack.
Branch and boundMeaning: A search technique that explores a state tree but prunes branches whose bound proves they cannot beat the best known solution. Complexity: Worst-case time is exponential. Space is O(depth) with DFS or exponential with best-first storage. Watch for: Weak bounds give little pruning. It is confused with backtracking, which prunes by infeasibility rather than by objective bounds.
Pseudopolynomial timeMeaning: A running-time class where the bound is polynomial in a numeric value in the input, not in the input length. Complexity: Typical forms are O(nW) time and O(W) or O(nW) space, where W is a numeric bound. Watch for: It is not truly polynomial when W can be exponential in the number of input bits.
About this deck

In data structures and algorithms, the miss is usually not forgetting a name. It is picking a hash table when ordering matters, trusting an average case when the worst case decides the answer, or blanking on the boundary rule that makes binary search go wrong. Interview and exam problems turn on those choices more than on raw memorization. This deck gives you 250 cards split across analysis (30), linear-structures (40), trees-and-heaps (45), sorting-and-searching (40), graphs (45), and algorithm-design (50). Each card covers one structure, algorithm, or concept, with the back cut into Meaning, Complexity, and Watch for. You review the idea, the bound, and the case that breaks the obvious answer together. Where average and worst case differ, the card says so. On a spaced-repetition schedule, the answers you really know stop showing up so often, while the weak spots keep coming back until the tradeoffs stick. That turns review from rereading notes into naming the right tool on demand. The deck leaves out long proofs and full implementations by choice, so practice stays centered on recognition, complexity, and failure cases.

Frequently asked

How is the deck split across topics?
It has analysis (30), linear-structures (40), trees-and-heaps (45), sorting-and-searching (40), graphs (45), and algorithm-design (50). The mix keeps complexity, core structures, and named algorithms in the same review cycle.
What kinds of cards are in this deck?
You get single-topic cards such as Big-O notation, Binary search, and the Held-Karp algorithm. Each back is organized as Meaning, Complexity, and Watch for so the definition, the bound, and the failure case stay linked.
What does this deck leave out on purpose?
It does not try to be a full textbook or a code notebook. Long proofs, full implementations, and extended worked problems are left out so review stays focused on choosing the right structure or algorithm, recalling complexity, and spotting the case that breaks it.
Can I import the whole deck on the free plan?
Yes. Importing a saved deck runs no new AI generation and spends no AI credits, so the free plan imports all 250 cards. You can study, edit and delete them afterwards.
Will importing it twice create duplicates?
No. Cards you already have are skipped and only cards added in a revision come through. Including re-imports after deleting it, one official deck can be imported three times per account.
Can I use it on the web and in the mobile app?
Yes. The deck is added to your account rather than to a device, so the same cards and the same progress are there on the web, on iOS and on Android.
Can I edit the cards after importing?
Yes. Imported cards are yours: you can edit both sides, delete cards you do not need, change tags, and move cards to another deck.

No official exam questions are reproduced. Every card was written for this deck.Editorial reference date 2026-08-30.