Quick Sort is generally considered faster than Merge Sort in practice. What is one of the main reasons for this?
Quick Sort typically has smaller constant factors in its time complexity.
Quick Sort has better time complexity in all cases.
Quick Sort has better space complexity than Merge Sort.
Quick Sort is a stable sorting algorithm, while Merge Sort is not.
Which of the following algorithms guarantees finding the target element in a sorted array if it exists?
Interpolation Search
Binary Search
Linear Search
Both Linear Search and Binary Search
What is the time complexity of resizing a dynamic array (like ArrayList in Java or vector in C++) when it becomes full?
O(n)
O(n log n)
O(log n)
O(1)
What is a key characteristic of a circular array?
It allows direct access to any element in O(1) time.
It has a fixed size that cannot be changed.
It automatically sorts elements in ascending order.
It conceptually wraps around, so the last element is followed by the first.
Which of the following is NOT a characteristic of a stable sorting algorithm?
Suitable for sorting objects based on multiple criteria.
Can be implemented in both recursive and iterative forms.
Always has a time complexity of O(n log n).
Preserves the order of equal elements.
What is the time complexity of searching for a target value in a sorted array using binary search?
Interpolation search is most likely to outperform binary search when:
The target element is located near the middle of the array.
The array is unsorted.
The array is uniformly distributed.
The array size is small.
Merge Sort is considered a stable sorting algorithm. What does 'stable' mean in this context?
The algorithm uses a fixed amount of memory regardless of the input size.
The algorithm maintains the relative order of elements with equal values after sorting.
The algorithm always takes the same amount of time to sort an array of a given size.
The algorithm is not affected by the initial order of elements in the array.
Which sorting algorithm has the least space complexity among Merge Sort, Quick Sort, and Heap Sort?
Merge Sort
Quick Sort
Heap Sort
What is the time complexity of rotating an array of size 'n' by 'k' positions in place?
O(k)
O(n*k)