CS 3343 – Fall 2011
Order Statistics
Carola Wenk Slides courtesy of Charles Leiserson with small
10/6/11 CS 3343 Analysis of Algorithms 1
Order Statistics Carola Wenk Slides courtesy of Charles Leiserson - - PowerPoint PPT Presentation
CS 3343 Fall 2011 Order Statistics Carola Wenk Slides courtesy of Charles Leiserson with small y changes by Carola Wenk 10/6/11 1 CS 3343 Analysis of Algorithms Order statistics Order statistics Select the i th smallest of n elements
10/6/11 CS 3343 Analysis of Algorithms 1
10/6/11 CS 3343 Analysis of Algorithms 2
10/6/11 CS 3343 Analysis of Algorithms 3
10/6/11 CS 3343 Analysis of Algorithms 4
1 log
9 / 10
10/6/11 CS 3343 Analysis of Algorithms 5
10/6/11 CS 3343 Analysis of Algorithms 6
k
−
1
n
=
k k
−
1
n k
10/6/11 CS 3343 Analysis of Algorithms 7
⎣ ⎦
= 2 /
n k k
−1
n k
⎣ ⎦
= 2 /
n k k
10/6/11 CS 3343 Analysis of Algorithms 8
−
1
n k
⎣ ⎦
− =
1 2 /
n n k k
⎣ ⎦
=
2 /
n k k
10/6/11 CS 3343 Analysis of Algorithms 9
−
1
n k
⎣ ⎦
− =
1 2 /
n n k k
⎣ ⎦
− =
1 2 /
n n k k
⎣ ⎦
=
2 /
n k k
k
10/6/11 CS 3343 Analysis of Algorithms 10
−
1
n k
⎣ ⎦
− =
1 2 /
n n k k
⎣ ⎦
− =
1 2 /
n n k k
⎣ ⎦
− − =
1 1 2 /
n n n k k
⎣ ⎦ ⎣ ⎦
= =
2 / 2 /
n k n k
10/6/11 CS 3343 Analysis of Algorithms 11
n k
−1
⎣ ⎦
n n k k
− = 1 2 /
⎣ ⎦
n n k k
− = 1 2 /
⎣ ⎦
n n n k k
− − = 1 1 2 /
⎣ ⎦ ⎣ ⎦
n n k n k
− = = 1 2 / 2 /
10/6/11 CS 3343 Analysis of Algorithms 12
⎣ ⎦
n k
= 2 /
⎣ ⎦
n k
−1 2 /
⎣ ⎦
n k= 2 /
10/6/11 CS 3343 Analysis of Algorithms 13
n
−1
⎣ ⎦
n k ∑ = 2 /
10/6/11 CS 3343 Analysis of Algorithms 14
n
−1
⎣ ⎦
n k
= 2 2 /
10/6/11 CS 3343 Analysis of Algorithms 15
−
n
1
⎣ ⎦
=
n k
2 2 /
10/6/11 CS 3343 Analysis of Algorithms 16
n
−
1
⎣ ⎦
n k
=
2 2 /
10/6/11 CS 3343 Analysis of Algorithms 17
10/6/11 CS 3343 Analysis of Algorithms 18
10/6/11 CS 3343 Analysis of Algorithms 19
10/6/11 CS 3343 Analysis of Algorithms 20
10/6/11 CS 3343 Analysis of Algorithms 21
lesser
lesser
10/6/11 CS 3343 Analysis of Algorithms 22
greater
lesser
lesser
10/6/11 CS 3343 Analysis of Algorithms 23
greater
10/6/11 CS 3343 Analysis of Algorithms 24
lesser
lesser
10/6/11 CS 3343 Analysis of Algorithms 25
greater
lesser
lesser
10/6/11 CS 3343 Analysis of Algorithms 26
greater
lesser
lesser
10/6/11 CS 3343 Analysis of Algorithms 27
greater
10/6/11 CS 3343 Analysis of Algorithms 28
10/6/11 CS 3343 Analysis of Algorithms 29
10/6/11 CS 3343 Analysis of Algorithms 30
Technical trick. This shows that T(n)∈ O(n)
10/6/11 CS 3343 Analysis of Algorithms 31
10/6/11 CS 3343 Analysis of Algorithms 32