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 enables efficient access, modification, and computation. It defines the relationship between data elements and operations.
What are the primary trade-offs when choosing a data structure?
Time complexity vs. space complexity vs. implementation complexity. Optimizing for fast lookups may require more memory; fast insertions may require slower searches.
Define an array and state one key trade-off.
Contiguous memory storing fixed-size elements. Trade-off: O(1) random access but O(n) insertion/deletion in middle; fixed size requires reallocation.
Define a linked list and its primary advantage over arrays.
Sequential data stored in nodes with pointers. Advantage: O(1) insertion/deletion at known position without reallocation. Disadvantage: O(n) access time, extra memory for pointers.
What problem does a hash table solve and what is its worst case?
Solves fast key-value lookup in O(1) average. Worst case: O(n) with poor hash function or high collision rate. Uses extra space for load factor management.
Compare binary search trees vs. hash tables for lookups.
BST: O(log n) average, O(n) worst case, maintains order, allows range queries. Hash table: O(1) average, O(n) worst case, unordered, faster for exact-match lookups.
Define a heap and state when to use it over a sorted array.
Complete binary tree where parent ≥ (or ≤) children. Use heap when you need repeated min/max extraction in O(log n), not full sort. Array sort is O(n log n) but requires all data upfront.
What is the space-time trade-off of a trie vs. hash table for string searches?
Trie: O(m) lookup (m = key length), O(nm) space (n keys), enables prefix queries. Hash table: O(1) lookup, O(n) space, no prefix support. Trie better for autocomplete; hash table better for isolated lookups.
When would you choose a graph adjacency list over an adjacency matrix?
Adjacency list: O(V + E) space, O(degree) edge iteration, better for sparse graphs. Matrix: O(V²) space, O(1) edge lookup, better for dense graphs or when checking if edge exists quickly.
Define amortized analysis and give one example.
Average cost per operation over a sequence, accounting for rare expensive operations. Example: dynamic array append is O(1) amortized—most appends are O(1), occasional O(n) resize is spread across many insertions.
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 →