Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.
Complexity & Efficiency AwarenessEasy
Q1. What does Big-O describe?
- A.The exact execution time needed
- B.The minimum time for the task
- C.The average case performance
- D.Upper bound of the growth rate✓ Correct
Explanation
Upper bound of growth.
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q2. What is O(1)?
- A.Linear time growth
- B.Constant time always✓ Correct
- C.Quadratic time growth
- D.Logarithmic time growth
Explanation
Same time regardless of input.
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q3. What is O(n)?
- A.Linear, proportional to input✓ Correct
- B.Quadratic time growth
- C.Constant time always
- D.Exponential time growth
Explanation
Proportional to input.
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q4. O(n) vs O(n^2) for large inputs?
- A.They perform exactly equal
- B.O(n^2) is faster overall
- C.O(n) is faster overall✓ Correct
- D.Cannot tell the difference
Explanation
O(n) is faster.
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q5. Space complexity measures?
- A.Memory relative to input size✓ Correct
- B.Disk storage used by files
- C.Lines of code in the program
- D.Screen pixels for the display
Explanation
Memory vs input size.
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q6. Array access by index?
- A.O(1)✓ Correct
- B.O(n^2)
- C.O(n)
- D.O(log n)
Explanation
Direct calculation: O(1).
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q7. Single for loop through n?
- A.O(1)
- B.O(n)✓ Correct
- C.O(log n)
- D.O(n^2)
Explanation
One pass: O(n).
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q8. O(log n) typical of?
- A.Binary search method✓ Correct
- B.Bubble sort algorithm
- C.Linear search scan
- D.Array index access
Explanation
Binary search method is the correct answer to this question.
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q9. Algorithm efficiency?
- A.How readable the code looks
- B.How fast you can type code
- C.Time and space usage vs input✓ Correct
- D.The number of lines of code
Explanation
Resource usage vs input.
Report an error in this question
Complexity & Efficiency AwarenessEasy
Q10. O(n) vs O(2^n)?
- A.O(2^n) grows faster than O(n)✓ Correct
- B.They grow at the same rate
- C.It depends on the input data
- D.O(n) grows faster than O(2^n)
Explanation
Exponential dwarfs linear.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q11. Two nested n-loops?
- A.O(n^2)✓ Correct
- B.O(n)
- C.O(2n)
- D.O(n log n)
Explanation
O(n^2) is the correct answer to this question.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q12. Merge sort space?
- A.O(n)✓ Correct
- B.O(1)
- C.O(log n)
- D.O(n^2)
Explanation
O(n) extra space.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q13. Bubble sort best case?
- A.O(n)✓ Correct
- B.O(n^2)
- C.O(1)
- D.O(n log n)
Explanation
O(n) with swap check.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q14. Big-O vs Omega vs Theta?
- A.O describes the lower bound only
- B.Theta describes the upper bound
- C.They are all the same thing
- D.O: upper, Omega: lower, Theta: tight✓ Correct
Explanation
Upper, lower, tight bounds.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q15. Insert at array beginning?
- A.O(n^2)
- B.O(log n)
- C.O(1)
- D.O(n)✓ Correct
Explanation
Shift all: O(n).
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q16. What is in-place?
- A.A very slow sorting algorithm
- B.O(1) or O(log n) extra space only✓ Correct
- C.An algorithm that does not work
- D.Uses lots of extra memory space
Explanation
Minimal extra space.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q17. Hash table average lookup?
- A.O(n)
- B.O(log n)
- C.O(1)✓ Correct
- D.O(n^2)
Explanation
O(1) is the correct answer to this question.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q18. Heap insert/extract?
- A.O(1)
- B.O(n log n)
- C.O(log n)✓ Correct
- D.O(n)
Explanation
O(log n) is the correct answer to this question.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q19. Why O(n log n) efficient for sorting?
- A.It is slower than O(n^2) sorting
- B.Theoretical lower bound for comparisons✓ Correct
- C.It is the slowest sort possible
- D.It only works on small inputs
Explanation
Optimal for comparison-based.
Report an error in this question
Complexity & Efficiency AwarenessMedium
Q20. Adjacency matrix space?
- A.O(V^2)✓ Correct
- B.O(V+E)
- C.O(V)
- D.O(E)
Explanation
O(V^2) is the correct answer to this question.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q21. Naive Fibonacci complexity?
- A.O(n)
- B.O(n^2)
- C.O(2^n)✓ Correct
- D.O(n log n)
Explanation
Exponential recomputation.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q22. Splay tree amortized?
- A.O(n)
- B.O(n log n)
- C.O(log n)✓ Correct
- D.O(1)
Explanation
O(log n) amortized.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q23. Adjacency list vs matrix?
- A.No meaningful difference exists
- B.O(V+E) vs O(V^2), saves space sparse✓ Correct
- C.Matrix is always better to use here
- D.They use exactly the same space
Explanation
Lists save space for sparse graphs.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q24. Dijkstra with binary heap?
- A.O(V^3)
- B.O((V+E) log V)✓ Correct
- C.O(V^2)
- D.O(E)
Explanation
O((V+E) log V).
Report an error in this question
Complexity & Efficiency AwarenessHard
Q25. P=NP asks?
- A.Are primes equal to naturals
- B.Verifiable in poly time means solvable?✓ Correct
- C.Do programs always need parameters
- D.Are pointers always needed in code
Explanation
Verification vs solving efficiency.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q26. Naive matrix mult n*n?
- A.O(n^2)
- B.O(n^2 log n)
- C.O(n^3)✓ Correct
- D.O(n)
Explanation
Three nested loops.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q27. Strassen significance?
- A.Same time as naive multiplication
- B.It is slower than naive approach
- C.Below O(n^3) at about O(n^2.807)✓ Correct
- D.It only works on 2x2 matrices
Explanation
Proves O(n^3) not optimal.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q28. What is NP-complete?
- A.An easy problem with fast solution
- B.In NP, all NP reduces to it in poly✓ Correct
- C.A problem with known O(n) solution
- D.A problem that is unsolvable always
Explanation
In NP, all NP reduces to it in poly is the correct answer to this question.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q29. Cache complexity?
- A.Same as hash table complexity analysis
- B.Cache misses affect real performance✓ Correct
- C.Only measures the cache memory size
- D.Same as space complexity of program
Explanation
Practical performance impact.
Report an error in this question
Complexity & Efficiency AwarenessHard
Q30. PSPACE?
- A.Polynomial time class problems
- B.Only applies to sorting algorithms
- C.The simplest complexity class known
- D.Polynomial space, contains P and NP✓ Correct
Explanation
P subset NP subset PSPACE.
Report an error in this question