ArtOfCode.org
Toggle Menu
Home
Online Rust Compiler
Tutorials
Algorithms 101
Html Css Tutorial
Javascript Tutorial
Blog
All Posts
Complexity Analysis and Big O
Check runtime and space reasoning.
1. What does Big O notation primarily describe in complexity analysis?
Exact runtime of an algorithm
Upper bound of an algorithm's growth rate
Lower bound of an algorithm's growth rate
Average runtime on small inputs
2. Which of the following algorithms have a worst-case time complexity of O(n²)?
Bubble Sort
Binary Search
Insertion Sort
Merge Sort
3. Big O notation considers the best-case scenario of an algorithm.
True
False
4. What does the 'O' in Big O stand for?
5. Which operation typically has a time complexity of O(1)?
Finding the maximum in an unsorted array
Accessing an element in an array by index
Linear search in an array
Sorting an array with QuickSort
6. Which time complexities are generally considered 'efficient' for large input sizes (n)?
O(1)
O(n)
O(n²)
O(log n)
O(2ⁿ)
7. The time complexity of a nested loop (two levels) where each loop runs from 1 to n is O(n²).
True
False
8. What is the time complexity of a binary search algorithm? (format: O(notation))
9. What is the space complexity of an algorithm that uses a fixed amount of additional memory regardless of input size?
O(n)
O(1)
O(log n)
O(n²)
10. Which algorithms have an average-case time complexity of O(n log n)?
Merge Sort
Bubble Sort
QuickSort
Insertion Sort
Heap Sort
11. Big O notation ignores constant factors and lower-order terms when simplifying complexity.
True
False
12. Name the scenario where an algorithm performs at its maximum efficiency (best, worst, or average case).
13. What is the worst-case time complexity of linear search on an array of size n?
O(1)
O(log n)
O(n)
O(n²)
14. Which scenarios have a space complexity of O(n)?
Storing all elements of an input array in a new array
Using a single variable to count elements
Recursive function with n levels of recursion
Binary search using an iterative approach
Merge Sort's auxiliary array
15. O(n log n) is more efficient than O(n) for very large n.
True
False
16. What is the worst-case time complexity of Bubble Sort? (format: O(notation))
17. What is the simplified Big O notation for O(3n² + 5n + 2)?
O(3n²)
O(n² + n)
O(n²)
O(5n)
18. Which statements about Big O notation are true?
Big O describes the exact number of operations an algorithm performs
O(n) is better than O(n log n) for large n
Big O is independent of hardware and programming language
O(1) is the best possible time complexity
19. The space complexity of an iterative linear search is O(1).
True
False
20. What term describes the average performance of an algorithm over all possible input cases?
Reset
Answered 0 of 0 — 0 correct