Which sorting algorithm has a time complexity of O(n^2) in its average and worst case?
Quick Sort
Merge Sort
Bubble Sort
Heap Sort
What is the worst-case time complexity of deleting an element from an unsorted array?
O(n)
O(1)
O(log n)
O(n log n)
Which data structure, when used for searching, can potentially improve the time complexity from O(n) to O(log n)?
Linked List
Binary Tree
Array
Queue
If an algorithm's time complexity is O(n^2), what can you conclude about its best-case time complexity?
It is Ω(n^2).
It is also O(n^2).
It is always constant, i.e., O(1).
It cannot be determined from the given information.
Which notation provides both an upper and lower bound on the growth of a function, implying the function grows at the same rate as the specified function?
Big Omega (Ω)
Little-omega (ω)
Big-O (O)
Big Theta (Θ)
Why is it crucial to consider real-world performance alongside theoretical time complexity analysis when designing algorithms?
Theoretical analysis is only relevant for academic purposes.
Real-world performance is always better than theoretical predictions.
Theoretical analysis is sufficient for predicting real-world performance.
Real-world factors like hardware and data distribution can significantly impact performance.
What is the time complexity of searching for an element in a sorted array using binary search?
What does an algorithm with a time complexity of O(n) signify?
The runtime increases linearly with the input size
The runtime is constant regardless of input size
The runtime increases exponentially with the input size
The runtime is unpredictable
If an algorithm has a time complexity of O(n log n), what can you infer about its runtime as the input size doubles?
It remains constant
It increases by a factor of log n
It increases exponentially
It increases slightly more than double
Which of the following statements is TRUE regarding the trade-off between code optimization and readability?
There's no trade-off; optimal performance and readability always go hand-in-hand.
Highly optimized code is always easier to read and maintain.
Excessive optimization can sometimes hinder code readability, making maintenance difficult.
Code readability is irrelevant as long as the code achieves optimal performance.