What is the worst-case time complexity of Merge Sort?
O(n^2)
O(n log n)
O(log n)
O(n)
What is the primary disadvantage of using Radix Sort compared to comparison-based sorting algorithms?
Inability to handle negative numbers effectively
Higher space complexity due to bucket usage
Significant performance degradation for nearly sorted data
Limited applicability to specific data types
What is the worst-case time complexity of Quick Sort and when does it occur?
O(n^2), when the input array is already sorted or reverse sorted
O(n^2), when the pivot is always the median element
O(n log n), when the pivot is always the median element
O(n log n), when the input array is sorted or reverse sorted
Which of the following real-world applications is well-suited for counting sort?
Sorting a collection of images based on their file sizes.
Sorting an array of timestamps representing events in chronological order.
Sorting a list of words alphabetically.
Sorting a large dataset of student GPAs ranging from 0.0 to 4.0.
In which scenario is Bucket Sort likely to perform poorly?
Data is already sorted in reverse order
Data consists of a small number of unique elements
Data is uniformly distributed within a known range
Data is heavily skewed towards one end of the range
Radix Sort utilizes which of the following properties of the input data to achieve its efficiency?
Distribution of the data values within a range
Pre-sortedness of the data
Order statistics of the data
Frequency of occurrence of data elements
Why is binary search a preferred algorithm for searching in sorted arrays compared to linear search?
Binary search is easier to implement and understand than linear search.
Binary search works correctly even on unsorted arrays, while linear search does not.
Binary search uses less memory than linear search.
Binary search has a time complexity of O(log n), which is significantly faster than linear search's O(n) complexity for large datasets.
Bucket Sort can be considered a stable sorting algorithm under which condition?
Bucket Sort is inherently stable regardless of the input or implementation.
The number of buckets is equal to the number of elements.
The underlying sorting algorithm used within each bucket is stable.
The input data is already sorted.
Which of the following statements accurately describes the stability of Quick Sort?
Quick Sort is inherently unstable
Quick Sort is inherently stable
Quick Sort can be easily modified to be stable
The stability of Quick Sort depends on the input data
Which of the following best describes the role of the base case in a recursive implementation of Quick Sort?
To define the condition when the array is fully sorted and the recursion should stop
To select the pivot element for each recursive call
To handle the comparison and swapping of elements during the sorting process
To partition the array around a chosen pivot element