Flashcards · Data Structures · Free
Data Structures flashcards, generated for you.
Example Data Structures study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example Data Structures flashcards
What is a data structure?
An organized way to store and manage data that defines how values are arranged in memory and what operations can be performed on them efficiently.
What are the four main operations evaluated in data structure trade-offs?
Search, insertion, deletion, and access. Each operation has a time complexity that varies by data structure; choosing a structure means prioritizing which operations matter most.
Array vs Linked List: which has O(1) random access and why?
Array. It stores contiguous memory locations, so the memory address of any element can be calculated directly using the index. Linked Lists require traversal, so access is O(n).
What is the space-time trade-off in hash tables?
Hash tables use extra memory (load factor < 1) to achieve O(1) average lookup, insertion, and deletion. Higher load factors increase collision probability, degrading to O(n) worst-case.
When is a binary search tree (BST) better than a hash table, and when is it worse?
BST is better for: sorted traversal, range queries, and when you need worst-case O(log n) guarantees. Worse because average case is O(log n) vs. hash table's O(1), and it requires ordering.
What problem does a heap solve, and what operation is it NOT good at?
Heaps efficiently find min/max in O(1) and insert/delete in O(log n). They are NOT good at search—finding an arbitrary element still requires O(n) linear scan.
Graph: adjacency matrix vs adjacency list—which is better for sparse graphs and why?
Adjacency list is better for sparse graphs. It uses O(V + E) space vs O(V²) for a matrix. For dense graphs, the matrix becomes competitive and offers O(1) edge lookup.
Why use a trie over a hash table for prefix searches?
A trie stores strings by shared prefixes and retrieves all words with a given prefix in O(m) time (m = prefix length), independent of dictionary size. Hash tables can't efficiently answer 'all words starting with X' queries.
What is the critical weakness of a balanced BST (AVL/Red-Black) compared to a simple BST?
Rebalancing overhead: insertion and deletion require tree rotations to maintain balance, adding complexity to code and constant factors to O(log n) operations. Unbalanced BSTs risk O(n) degradation if unlucky with insertion order.
Why choose a skip list or B-tree in practice over a balanced BST?
Skip lists are simpler to implement and randomized (no rotations). B-trees minimize disk I/O on external storage by storing many keys per node, critical for databases. Both have O(log n) operations with better real-world constants or cache behavior.
Make your own Data Structures study set
Flashcards for related topics
Studying Data Structures to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →