Which statement about benchmarking is TRUE?
Benchmarking is primarily used for comparing the theoretical time complexity of different algorithms.
Benchmarking results are always generalizable across different hardware and software environments.
Benchmarking focuses on measuring the execution time of an algorithm in a controlled environment.
Benchmarking is only useful for large-scale applications and not for smaller projects.
An algorithm processes an input list of size n. It first performs an O(n log n) sorting operation. Then, for each element in the sorted list, it performs a nested loop iterating over all pairs of elements in the list. What is the overall time complexity of this algorithm?
O(n^2 log n)
O(n^2)
O(n log n)
O(n^3)
A recursive function has a base case that executes in O(1) time. For each recursive step, it makes 3 recursive calls with input size n/2. What is the overall time complexity of this function?
O(n)
O(n^log_2(3))
Why is time complexity generally considered more important than space complexity in algorithm analysis?
Space complexity cannot be expressed using Big-O notation.
Time complexity is always more difficult to analyze.
Modern computers have abundant memory, while efficient time utilization often remains a bottleneck.
Space complexity is irrelevant in modern computing.
An algorithm processes an input array of size 'n'. It iterates through the array once, performing constant-time operations for each element. Inside the loop, it calls a helper function that has a time complexity of Θ(log n). What is the overall time complexity of this algorithm?
O(log n)
You need to sort a large dataset. Algorithm A has a time complexity of O(n log n) and a space complexity of O(1). Algorithm B has a time complexity of O(n) but requires O(n) extra space. Which algorithm is preferable if memory usage is severely constrained?
Insufficient information to determine
Algorithm B
Algorithm A
Both are equally preferable
You have two algorithms, A and B, for the same problem. A has a time complexity of O(n log n) and Ω(n), while B has a time complexity of O(n^2) and Ω(log n). Which of the following statements is always true?
We cannot definitively compare the performance of the two algorithms based on the given information.
Algorithm A is faster than Algorithm B for sufficiently large input sizes.
Algorithm A is faster than Algorithm B for all input sizes.
Algorithm B is faster than Algorithm A for all input sizes.
Consider a nested loop structure where the outer loop runs n times and the inner loop runs from 1 to i, where 'i' is the current iteration of the outer loop. What is the total number of iterations of the inner loop?
log n
n
n(n+1)/2
n^2
The statement 'f(n) = o(g(n))' implies which of the following?
f(n) is asymptotically slower than g(n) as n approaches infinity.
f(n) and g(n) have the same growth rate.
f(n) is always strictly slower than g(n) for all values of n.
g(n) is an upper bound, but not necessarily a tight bound, for f(n).
You are given a sorted array of n integers. You want to determine if there exists a pair of elements in the array that sum up to a specific target value. Which algorithm provides the most efficient time complexity?
Sorting the array and then using binary search
Nested loops to check all pairs
Using a hash table to store seen elements
Using two pointers, one at the beginning and one at the end of the array