



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Professor: Shull; Class: Fundamental Algorithms; Subject: Computer Science; University: Wellesley College; Term: Fall 1996;
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!
Wellesley College ◊ CS231 Algorithms ◊ October 11, 1996 Handout #
ORDER STATISTICS
Reading: CLR Chapter 10
Terminology**
Let S be a set of n elements (necessarily distinct).
The i th order statistic of S is the i th smallest element (i.e., the element that is larger than exactly i - 1 other elements in the set). Such an element is said to have rank i.
The minimum of S is the first order statistic (element with rank 1).
The maximum of S is the nth order statistic (element with rank n).
The median (s) of S is (are) the element(s) with rank (^) (n+1)/2 and (n+1)/2.
Example: B = {43 5 17 91 2 42 19 72 37 3}
The Selection Problem
Specification:
Select(A, i) Return the ith order statistic from an array of n (distinct) elements.
Trivial algorithm:
Select(A, i) Sort(A) return A[i]
Can obviously be done in Θ(n lg(n)) time.
The main question of today's lecture: Can we do better?
Important special cases:
Selection in Worst Case Linear Time
Presentation in CLR is confusing. I prefer the following explanation.
We will consider the median-of-median-of-c algorithm, where c is an integer constant ≥ 1.
Median-of-Median-of-c(c, A, i)
Analysis: