Analysis of random splitters Flashcards
What is the goal of the median-finding problem?
To find the middle element of a sorted set of numbers.
What is the Select algorithm used for?
Select(S, k) finds the kth largest element in a set S of n numbers.
What is the base case for the Select algorithm?
If |S| = 1, then the single element in S is returned.
Why is a ‘splitter’ chosen in the Select algorithm?
A splitter divides the set S into subsets S- and S+, allowing the search for the kth largest element to focus on a smaller subset.
What is the expected time complexity of the Select algorithm?
The expected time complexity is O(n).
How does the choice of a splitter affect the Select algorithm’s performance?
A well-centered splitter significantly reduces the size of the subset considered in recursive calls, improving performance.
What happens if the splitter in Select is the minimum element?
The algorithm performs poorly, as the recursive call reduces the subset size by only one element.
Why is randomization used to choose the splitter in Select?
Randomization ensures a high probability of choosing a well-centered splitter, avoiding worst-case scenarios.
What is the probability of selecting a ‘central’ splitter in the Select algorithm?
The probability is 1/2, as half of the elements in the set are central.
What is the recurrence for Select when random splitters are used?
T(n) ≤ T((3/4)n) + cn, which resolves to O(n) using geometric series analysis.
What is the Quicksort algorithm?
Quicksort is a sorting algorithm that uses a random splitter to divide a set into two subsets, recursively sorting each.
What is the worst-case running time of Quicksort?
The worst-case running time is O(n^2), occurring when splitters are poorly chosen (e.g., smallest elements).
What is the expected running time of Quicksort?
The expected running time is O(n log n), achieved through randomization of splitters.
What is a central splitter in Quicksort?
A central splitter divides the set so that each subset contains at least a quarter of the elements.
What is the role of randomization in Quicksort?
Randomization increases the likelihood of selecting central splitters, ensuring efficient sorting.