diff --git a/curriculum/challenges/english/blocks/quiz-data-structures/67f41341453c2247fb2828f7.md b/curriculum/challenges/english/blocks/quiz-data-structures/67f41341453c2247fb2828f7.md index b9e385f019e..78d56a93483 100644 --- a/curriculum/challenges/english/blocks/quiz-data-structures/67f41341453c2247fb2828f7.md +++ b/curriculum/challenges/english/blocks/quiz-data-structures/67f41341453c2247fb2828f7.md @@ -17,439 +17,439 @@ To pass the quiz, you must correctly answer at least 18 of the 20 questions belo #### --text-- -Placeholder question +What does Big O notation describe in algorithm analysis? #### --distractors-- -Placeholder distractor 1 +The exact runtime in seconds for a specific computer. --- -Placeholder distractor 2 +The percentage of code lines executed during a run. --- -Placeholder distractor 3 +How readable the code is to other developers. #### --answer-- -Placeholder answer +How the time or space grows relative to input size (an upper bound). ### --question-- #### --text-- -Placeholder question +When starting an algorithmic challenge, what is the best first step? #### --distractors-- -Placeholder distractor 1 +Begin coding immediately to gain momentum. --- -Placeholder distractor 2 +Optimize for performance before you understand the problem. --- -Placeholder distractor 3 +Write unit tests only after finishing the solution. #### --answer-- -Placeholder answer +Clarify the problem and constraints with examples and edge cases. ### --question-- #### --text-- -Placeholder question +What is the key difference between dynamic arrays and static arrays? #### --distractors-- -Placeholder distractor 1 +Dynamic arrays store values of different types; static arrays cannot. --- -Placeholder distractor 2 +Static arrays allow duplicate values; dynamic arrays do not. --- -Placeholder distractor 3 +Dynamic arrays are faster than static arrays for every operation. #### --answer-- -Placeholder answer +Dynamic arrays can grow or shrink by resizing; static arrays have a fixed size. ### --question-- #### --text-- -Placeholder question +What is the amortized time complexity of appending an element to the end of a dynamic array? #### --distractors-- -Placeholder distractor 1 +`O(n)` --- -Placeholder distractor 2 +`O(log n)` --- -Placeholder distractor 3 +`O(n log n)` #### --answer-- -Placeholder answer +`O(1)` amortized. ### --question-- #### --text-- -Placeholder question +Why does accessing the k-th element by index in a singly linked list take `O(n)` time? #### --distractors-- -Placeholder distractor 1 +The list must be resized before any access. --- -Placeholder distractor 2 +The index is hashed and looked up in a table. --- -Placeholder distractor 3 +Nodes are stored contiguously, so shifting is required. #### --answer-- -Placeholder answer +You must traverse from the head node to the k-th node one by one. ### --question-- #### --text-- -Placeholder question +Which feature does a doubly linked list have that a singly linked list does not? #### --distractors-- -Placeholder distractor 1 +Random access to any index in `O(1)` time. --- -Placeholder distractor 2 +A built-in array buffer for faster iteration. --- -Placeholder distractor 3 +Automatic maintenance of the list length as a constant. #### --answer-- -Placeholder answer +Pointers to both next and previous nodes enabling backward traversal. ### --question-- #### --text-- -Placeholder question +Which of the following best describes a stack? #### --distractors-- -Placeholder distractor 1 +First In, First Out (`FIFO`) with removals at the front. --- -Placeholder distractor 2 +A structure where any element can be removed in `O(1)` time. --- -Placeholder distractor 3 +A circular buffer with constant-time random access. #### --answer-- -Placeholder answer +Last In, First Out (`LIFO`) with `push` and `pop` at the top. ### --question-- #### --text-- -Placeholder question +Which operation removes the element at the front of a queue? #### --distractors-- -Placeholder distractor 1 +`push` --- -Placeholder distractor 2 +`pop` --- -Placeholder distractor 3 +`peek` #### --answer-- -Placeholder answer +`dequeue` ### --question-- #### --text-- -Placeholder question +What is the typical average-case time complexity to look up a value by key in a hash map? #### --distractors-- -Placeholder distractor 1 +`O(n)` because all keys must be scanned sequentially. --- -Placeholder distractor 2 +`O(log n)` due to binary search within buckets. --- -Placeholder distractor 3 +`O(n log n)` because keys are sorted during insertion. #### --answer-- -Placeholder answer +`O(1)` on average with a good hash function and low load factor. ### --question-- #### --text-- -Placeholder question +Which guarantee is provided by a set data structure? #### --distractors-- -Placeholder distractor 1 +Elements are stored in sorted order by default. --- -Placeholder distractor 2 +Duplicate values are allowed and kept together. --- -Placeholder distractor 3 +Elements are indexed by their insertion position. #### --answer-- -Placeholder answer +It stores only unique elements (no duplicates). ### --question-- #### --text-- -Placeholder question +In a dynamic array, what is the worst-case time complexity of inserting an element at index i (not at the end)? #### --distractors-- -Placeholder distractor 1 +`O(1)` --- -Placeholder distractor 2 +`O(log n)` --- -Placeholder distractor 3 +`O(1)` amortized #### --answer-- -Placeholder answer +`O(n)` ### --question-- #### --text-- -Placeholder question +What is the time complexity of inserting a new node at the head of a singly linked list? #### --distractors-- -Placeholder distractor 1 +`O(n)` --- -Placeholder distractor 2 +`O(log n)` --- -Placeholder distractor 3 +`O(n log n)` #### --answer-- -Placeholder answer +`O(1)` ### --question-- #### --text-- -Placeholder question +Which operation returns the top element of a stack without removing it? #### --distractors-- -Placeholder distractor 1 +`push` --- -Placeholder distractor 2 +`pop` --- -Placeholder distractor 3 +Insert at bottom. #### --answer-- -Placeholder answer +`peek` ### --question-- #### --text-- -Placeholder question +Which of the following best describes a queue? #### --distractors-- -Placeholder distractor 1 +Last In, First Out (`LIFO`) with removals at the top. --- -Placeholder distractor 2 +Random access to any index in `O(1)` time. --- -Placeholder distractor 3 +Elements are always kept in sorted order automatically. #### --answer-- -Placeholder answer +First In, First Out (`FIFO`) with `enqueue` at the back and `dequeue` at the front. ### --question-- #### --text-- -Placeholder question +What is a hash collision in a hash map? #### --distractors-- -Placeholder distractor 1 +When a key maps to multiple distinct values by design. --- -Placeholder distractor 2 +When two identical keys are stored in different buckets. --- -Placeholder distractor 3 +When the map runs out of memory and must be resized. #### --answer-- -Placeholder answer +When two different keys produce the same hash index. ### --question-- #### --text-- -Placeholder question +Why do hash maps resize (rehash) as they grow? #### --distractors-- -Placeholder distractor 1 +To sort keys in ascending order for faster iteration. --- -Placeholder distractor 2 +To compress values and reduce memory fragmentation. --- -Placeholder distractor 3 +To avoid triggering the language's garbage collector. #### --answer-- -Placeholder answer +To keep the load factor low so that average operations remain `O(1)`. ### --question-- #### --text-- -Placeholder question +Which statement about sets is true? #### --distractors-- -Placeholder distractor 1 +Sets preserve insertion order by definition. --- -Placeholder distractor 2 +Sets allow duplicate elements and keep counts. --- -Placeholder distractor 3 +Set membership tests are `O(n log n)` on average. #### --answer-- -Placeholder answer +Membership tests are typically `O(1)` on average. ### --question-- #### --text-- -Placeholder question +Which time complexity grows faster than `O(n log n)` as n becomes large? #### --distractors-- -Placeholder distractor 1 +`O(n)` --- -Placeholder distractor 2 +`O(log n)` --- -Placeholder distractor 3 +`O(1)` #### --answer-- -Placeholder answer +`O(n^2)` ### --question-- #### --text-- -Placeholder question +After implementing a brute-force solution, what is a good next step? #### --distractors-- -Placeholder distractor 1 +Micro-optimize constant factors before measuring. --- -Placeholder distractor 2 +Discard tests and rewrite the solution from scratch. --- -Placeholder distractor 3 +Avoid considering edge cases to keep the code simple. #### --answer-- -Placeholder answer +Analyze its time/space complexity and optimize identified bottlenecks. ### --question-- #### --text-- -Placeholder question +What does space complexity measure? #### --distractors-- -Placeholder distractor 1 +How many CPU cores a program uses. --- -Placeholder distractor 2 +The length of a program in lines of code. --- -Placeholder distractor 3 +How long a program takes to compile. #### --answer-- -Placeholder answer +How memory usage grows relative to input size.