• Tidak ada hasil yang ditemukan

Application 2 of the Union Theorem Randomized Quick sort

N/A
N/A
Protected

Academic year: 2025

Membagikan "Application 2 of the Union Theorem Randomized Quick sort"

Copied!
32
0
0

Teks penuh

(1)

Randomized Algorithms

CS648

Lecture 7

Two applications of Union Theorem

• Balls into Bin experiment : Maximum load

Randomized Quick Sort: Concentration of the running time

1

(2)

Union theorem

•  

2

(3)

Union theorem

•  

3

(4)

APPLICATION 1 OF THE UNION THEOREM

BALLS INTO BINS: MAXIMUM LOAD

4

(5)

Balls into Bins

•  

5

1       2       3       …       i      …       n 1     2      3    4      5       …       m-1   m

(6)

Balls into Bins

•  

6

1       2       3       …       j      …       n 1     2      3    4      5       …       m-1   m

(7)

Balls into Bins

The main difficulty and the way out

•  

7

1       2       3       …       j      …       n 1     2      3    4      5       …       m-1   m

(8)

 

•  

8

1       2       3       …       j      …       n 1     2      3    4      5       …       m-1   m

 

(9)

 

•  

9

1       2       3       …       j      …       n 1     2      3    4      5       …       m-1   m

   

(10)

10

(11)

 

•  

11

 

 

(12)

Balls into Bins

•  

12

(13)

APPLICATION 2 OF THE UNION THEOREM

RANDOMIZED QUICK SORT:

THE SECRET OF ITS POPULARITY

13

(14)

Concentration of Randomized Quick Sort

•  

14

A

   

(15)

Concentration of Randomized Quick Sort Tools needed

•  

15

 

(16)

Randomized QuickSort

The main difficulty and the way out

•  

16

Elements of A arranged in   

Increasing order of values

 

(17)

Randomized QuickSort

The main difficulty and the way out

•  

17

Elements of A arranged in   

Increasing order of values

(18)

 

18

Elements of A arranged in  Increasing order of values

 

 

(19)

 

•  

19

(20)

Randomized QuickSort

A new way to count the comparisons

•  

20

Elements of A arranged in  Increasing order of values

(21)

Randomized QuickSort

Applying Union theorem

•  

21

 

(22)

22

(23)

Randomized Quick Sort

Definition: a recursive call is good if the pivot is selected from the middle  half, and bad otherwise.

P(a recursive call is good) = ??

Notation: The size of a recursive call is the size of the subarray it sorts.

23

middle-half

Increasing order of values

 

(24)

Randomized Quick Sort

•  

24

middle-half

Increasing order of values

(25)

Randomized Quick Sort

•  

25

middle-half  

Increasing order of values

(26)

 

•  

26

 

(27)

Randomized Quick Sort Final result

•  

27

(28)

SOME WELL KNOWN AND WELL STUDIED

RANDOM VARIABLES

28

(29)

Bernoulli Random Variable

•  

29

(30)

Binomial Random Variable

•  

30

(31)

Geometric Random Variable

•  

31

(32)

Negative Binomial Random Variable

•  

32

Referensi

Dokumen terkait