Upload
others
View
9
Download
0
Embed Size (px)
Citation preview
Randomized Algorithms CS648
Lecture 26
A few memorable problems
1
RANDOMIZED INCREMENTAL CONSTRUCTION
2
Convex Hull algorithm
Theorem:
There is an O(π π₯π¨π π ) time Las Vegas algorithm for computing convex hull.
3
Assignment 4: Concentration of running time.
Randomized QuickSort
Aim: To show P(πΏ > 8π lππ4/3 π) < πβ7
4
ππ Elements of A arranged in Increasing order of values
ππ
Right perspective
Randomized QuickSort
Aim: To show P(πΏ > 8π lππ4/3 π) < πβ7
5
ππ Elements of A arranged in Increasing order of values
Right perspective
Randomized QuickSort from perspective of ππ
6
Elements of A arranged in Increasing order of values
ππ
ππ leaves the algorithm
Randomized QuickSort from perspective of ππ
ππ: no. of recursive calls in which ππ participates before being selected as a pivot.
Question: Is there any relation between π and ππ ?
Answer: π = ππππ=1
7
CONVEX HULL ALGORITHM
8
Randomized algorithm for convex hull
Convex-hull-algorithm(π·) { Let <ππ,ππ,β¦,ππ > be a uniformly random permutation of π·;
π― triangle(ππ,ππ, ππ);
For π = π to π do
insert ππ and update π―
return π―;
}
9
10
Conflict graph : a powerful data structure
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
cones π β π points ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
Before entering the for loop
11
ππ
ππ
ππ
ππ
ππ
ππ
π β π points cones
INSERTING πTH POINT
12
πth iteration
13
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
πth iteration
14
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
π β π + π points cones ππ
πth iteration
15
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
π β π + π points cones ππ
πth iteration
16
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
π β π + π points cones ππ
πth iteration
17
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
π β π points cones ππ
πth iteration
18
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
π β π points cones ππ
πth iteration
19
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
π β π points cones ππ
πth iteration
20
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
π β π points cones ππ
πth iteration
21
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
ππ
π β π points cones ππ
πβ²
π"
πth iteration
22
ππ
πβ²
π"
ππ
ππ
ππ
πβ²
π"
ππ
ππ
ππ
π β π points cones ππ
Running time of πth iteration
Running time of πth iteration is of the order of
β’ Number of edges of convex hull that are destroyed
β’ Number of new edges of convex hull that are created
β’ Number of points in the two adjacent cones that get created
23
Total time for π iterations = O(π)
πΏπ
Key idea: No. of cones to which a point belongs during the algorithm
24
26
27
28
29
30
LOAD BALANCE
31
Balls into Bins
Ball-bin Experiment: There are π balls and π bins.
Each ball selects its bin randomly uniformly and independent of other balls
and falls into it.
Applications: β’ Hashing
β’ Load balancing in distributed environment 32
1 2 3 β¦ π β¦ π
1 2 3 4 5 β¦ π β 1 π
Balls into Bins
Question : What is the load of most heavily loaded bin ?
33
1 2 3 β¦ π β¦ π
1 2 3 4 5 β¦ π β 1 π
O(log π / log log π)
Balls into Bins
34
1 2 3 β¦ π β¦ π
π
Balls into Bins
Question : What is the load of most heavily loaded bin ?
35
1 2 3 β¦ π β¦ π
O(log log π)
π
A NOVEL SOLUTION
36
Balls into Bins
37
1 2 3 β¦ π β¦ π
Generalization
What if each ball chooses π bin randomly uniformly ?
What if there is asymmetry in breaking ties ?
38
O(π₯π¨π π₯π¨π π
π₯π¨π π )
Balls into Bins
39
1 2 3 β¦ π
2+ 1 β¦ π
π
O(π₯π¨π π₯π¨π π
π )
Berthold VΓΆcking: How asymmetry helps load balancing. J. ACM 50(4): 568-589 (2003)
Interested students should ponder over it. The following paper gives an elegant proof for this claim. This is the most beautiful proof I ever read.
This is the end of the course.
β’ If you liked the course, it is because of the radiating beauty of βrandomized algorithmsβ.
β’ If you dislikes the course, it might be because I did not do a good job.
β’ I look forward to your feedback/evaluation to improve.
β’ Thanks a lot and best wishes for your wishes.
β’ I am truly honored to teach the brightest students of my country
40