What factors guide data-structure selection?
Choose a structure by considering required operations, their frequency, data properties, memory and locality, correctness constraints, and maintainability.
Study 10 Data Structure and Algorithm Trade-offs with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What factors guide data-structure selection?
Choose a structure by considering required operations, their frequency, data properties, memory and locality, correctness constraints, and maintainability.
What are key dynamic-array operation costs?
A dynamic array provides O(1) indexing and amortized O(1) appending, but insertion or deletion in the middle is O(n) because elements move.
What is linked-list access time by position?
Accessing position i in a linked list is O(n), because nodes must be followed sequentially from a known starting point.
What processing order does a stack enforce?
A stack follows last-in, first-out order: `push` adds an item, `pop` removes the newest item, and `peek` inspects it.
What processing order does a queue enforce?
A queue follows first-in, first-out order: `enqueue` adds at the rear, while `dequeue` removes the oldest item from the front.
How does balance affect BST operation costs?
A balanced BST typically supports search, insertion, and deletion in O(logn); an unbalanced BST can degrade to O(n).
What is the typical hash-table complexity profile?
A hash table offers expected O(1) exact-key lookup, insertion, and deletion with a good hash function and controlled load factor, but its worst case is O(n).
What is binary search’s comparison complexity?
Binary search takes O(logn) comparisons by repeatedly halving a sorted search interval.
What trade-off does a sorted array create?
A sorted array combines O(logn) binary search with O(n) insertion, because inserting at the correct position moves elements.
What distinguishes merge sort?
Merge sort has O(nlogn) worst-case time, is stable, and suits linked lists or external data; typical array implementations need extra storage.
What three elements make recursion correct?
A recursive function needs a base case, progress toward that case, and a way to combine recursive results.
What is the total cost of sorting once and doing m binary searches?
The total is O(nlogn+mlogn): O(nlogn) to sort once plus O(mlogn) for m binary searches.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
Learn how Boolean expressions, logical operators, and conditional structures let programs make reliable decisions, including how to handle boundaries, branch order, and testing.
A structured guide to the main data structures, their operations, efficiency trade-offs, representations, and practical selection criteria.
A 14-question quiz on trees, binary trees, traversals, recursive algorithms, and binary search trees. The questions progress from foundational concepts to applied reasoning about structure, complexity, and BST operations.
A structured guide to comparison-based sorting algorithms, their complexity, stability, memory use, and practical selection criteria.
A progression through how data is organized, searched, exposed through software interfaces, and managed through abstraction layers in modern computer systems.
A medium-difficulty quiz on integrating problem definition, representation, algorithms, complexity analysis, testing, correctness, ethical evaluation, and documentation in a computer science capstone.
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.