randomized algorithms - ict.iitk.ac.inย ยท randomized quicksort aim: to show p(๐ฟ > 8 l ๐4/3...
TRANSCRIPT
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