Data Structures & Algorithms
The question sheet
Reveal any answer as you study-
A ____ follows last-in, first-out (LIFO) order.
- array
- queue
- tree
- stack
Reveal answer
Answer: stack
-
Which data structure follows FIFO order?
- Hash table
- Queue
- Stack
- Graph
Reveal answer
Answer: Queue
-
What is the time complexity of binary search?
- O(n²)
- O(1)
- O(n)
- O(log n)
Reveal answer
Answer: O(log n)
-
____ store elements in contiguous memory for constant-time index access.
- Arrays
- Stacks
- Linked lists
- Graphs
Reveal answer
Answer: Arrays
-
BFS uses a queue and explores level by level.
- True
- False
Reveal answer
Answer: True
-
DFS uses a queue to explore as deeply as possible.
- True
- False
Reveal answer
Answer: False
-
What complexity is typical of merge sort and quicksort?
- O(n log n)
- O(1)
- O(log n)
- O(n²)
Reveal answer
Answer: O(n log n)
-
____ stores results of subproblems to avoid repeating work.
- Greedy
- Dynamic programming
- Hashing
- Recursion
Reveal answer
Answer: Dynamic programming
-
Which pattern tracks a range of elements for substring problems?
- Two-pointer
- Sliding window
- Greedy
- Recursion
Reveal answer
Answer: Sliding window
-
Greedy algorithms make the locally best choice at each step.
- True
- False
Reveal answer
Answer: True
-
What do hash tables provide on average?
- Constant-time lookup
- Sorted order
- LIFO order
- Level-by-level access
Reveal answer
Answer: Constant-time lookup
-
A loop running one time too many is called an ____ error.
- recursion
- off-by-one
- null
- overflow
Reveal answer
Answer: off-by-one
-
O(2ⁿ) represents exponential time complexity.
- True
- False
Reveal answer
Answer: True
-
Which structure models networks of connected nodes?
- Stacks
- Graphs
- Arrays
- Queues
Reveal answer
Answer: Graphs
-
What underlies divide-and-conquer strategies like merge sort?
- Recursion
- Two-pointer
- Greedy
- Hashing
Reveal answer
Answer: Recursion
Make your own — free
Turn any notes into a game in under a minute. Free to start.