Is Merge Sort an in-place sorting algorithm?
Yes
No
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 input array is sorted or reverse sorted
O(n log n), when the pivot is always the median element
Bucket Sort achieves its efficiency by:
Exploiting the relative order of elements within the input
Recursively dividing the input into smaller subproblems
Distributing elements into buckets based on their range
Using a priority queue to maintain sorted order during insertion
Which of the following describes the space complexity of counting sort?
O(n)
O(n + k), where k is the range of input values
O(log n)
O(1)
Which of the following best describes the heap property in a binary heap used for Heap Sort?
The left and right subtrees are sorted
The heap is always a complete binary tree
Each node is greater than or equal to its children
Each node is smaller than or equal to its children
What is the primary mechanism behind Merge Sort's efficiency?
Using a hash table to store and retrieve sorted elements
Recursive division of the input array into smaller subarrays
Iterative comparison of adjacent elements
Building a binary search tree from the input data
Which of the following real-world applications is well-suited for counting sort?
Sorting an array of timestamps representing events in chronological order.
Sorting a collection of images based on their file sizes.
Sorting a list of words alphabetically.
Sorting a large dataset of student GPAs ranging from 0.0 to 4.0.
In computational geometry, how is sorting used in finding the closest pair of points from a set of points in a 2D plane?
The points are sorted randomly, and the distances between consecutive points are compared to find the closest pair.
Sorting is not directly relevant to finding the closest pair of points; it can be solved more efficiently using hashing techniques.
Sorting is only used if the points are uniformly distributed in the plane; otherwise, a different approach is required.
The points are sorted based on their x-coordinates, and then a divide-and-conquer approach is used to efficiently compare distances between points in the sorted order.
What is the primary disadvantage of using Radix Sort compared to comparison-based sorting algorithms?
Limited applicability to specific data types
Significant performance degradation for nearly sorted data
Inability to handle negative numbers effectively
Higher space complexity due to bucket usage
How does the choice of pivot affect the performance of Quick Sort?
The choice of pivot has no impact on the performance of Quick Sort
A poorly chosen pivot can lead to the worst-case time complexity of O(n^2)
Using the first element as the pivot is generally the most efficient approach
Selecting a random pivot always guarantees the best performance