The proof is based on the following observation. With probability 2 the pivot se
ID: 3712675 • Letter: T
Question
The proof is based on the following observation. With probability 2 the pivot selected will be between and (i.e. a good pivot). Also with probability the pivot selected will be between l and ? or between 34 and n (i.e. a bad pivot). (1 points) 1. State a recurrence that expresses the worst case for bad pivots. (1 points) 2. State a recurrence that expresses the worst case for good pivots. (2 points) 3. State a recurrence that expresses the expected worst case by combining the first two recurrences. (6 points) 4. Prove by induction that your recurrence is in O(nlog n).Explanation / Answer
ANSWER
GIVEN BY
In worst container of bad pivot can be also of the end points, i.e. 1 or n. In together cases, the structure will not dicompodet into 2 sructures, but into 1 sructure of distance end to end n-1,
so we have
T(n) = T(n-1) + c; anywhere c is steady time for finding the pivot
The most excellent of all good cases at what time n is in the mid. So as we see the algorithm improve as the pivot approaches the mid of the collection.
So worst case of most excellent case would be if pivot is at n/4 or 3n/4.
If pivot is positioned at either of these points,the collection will be divided into two sub array of length(n/4) and lingth(3n/4). So the recuernece family member would exist
T(n) = T((n-1) / 4) + T(3*(n-1) / 4) + C
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.