Lecture 16: Randomized Incremental Construction

advertisement
Randomized Algorithms
CS648
Lecture 16
Randomized Incremental Construction
(Backward analysis)
1
PROBLEM 1
FIND-MIN PROBLEM
2
Find-Min algorithm
A
1
2
Find-Min(A[1..๐’])
{ ๐’Ž๐’Š๐’ ๏ƒŸ A[1];
For ๐’Š = ๐Ÿ to ๐’ do
{ if (A[๐’Š] < ๐’Ž๐’Š๐’)
๐’Ž๐’Š๐’ ๏ƒŸ A[๐’Š] ;
}
return ๐’Ž๐’Š๐’;
}
๐’−๐Ÿ
…
๐‘ฟ: no. of times ๐’Ž๐’Š๐’ is updated.
๐‘ฟ๐’Š =
๐Ÿ if ๐’Ž๐’Š๐’ is updated in ๐’Šth iteration
๐ŸŽ otherwise
๐‘ฟ=๐Ÿ+
๐’Š>๐Ÿ ๐‘ฟ๐’Š
๏ƒจ๐„ ๐— =๐Ÿ+
=๐Ÿ+
Probability that
“A[๐’Š] is smaller than {A[๐Ÿ],…, A[๐’Š − ๐Ÿ]}”
๐’Š>๐Ÿ ๐„[๐‘ฟ๐’Š ]
๐’Š>๐Ÿ ๐(๐‘ฟ๐’Š
= ๐Ÿ)
??
3
Forward analysis for
First ๐’Š − ๐Ÿ elements
๐(๐‘ฟ๐’Š = ๐Ÿ)
A
1
2
Find-Min(A[1..๐’])
{ ๐’Ž๐’Š๐’ ๏ƒŸ A[1];
For ๐’Š = ๐Ÿ to ๐’ do
{ if (A[๐’Š] < ๐’Ž๐’Š๐’)
๐’Ž๐’Š๐’ ๏ƒŸ A[๐’Š] ;
}
return ๐’Ž๐’Š๐’;
}
…
๐’Š
๐’−๐Ÿ
Notations:
• ๐‘บ๐’Š−๐Ÿ : set of all subsets of A of size ๐’Š − ๐Ÿ.
• For any ๐’‚ ∈ ๐‘บ๐’Š−๐Ÿ ,
๐“”๐’‚ : first ๐’Š − ๐Ÿ elements of A are some
permutation of ๐’‚.
Using Partition Theorem,
๐(๐‘ฟ๐’Š = ๐Ÿ) = ๐’‚∈๐‘บ๐’Š−๐Ÿ ๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚
โˆ™ ๐(๐“”๐’‚ )
4
Forward analysis for
๐(๐‘ฟ๐’Š = ๐Ÿ)
๐’‚ : a subset of ๐’Š − ๐Ÿ elements.
๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚ =
“Given that first ๐’Š − ๐Ÿ elements of A are some permutation of ๐’‚, what is prob.
that ๐‘ฟ๐’Š = ๐Ÿ ?”
For this event to happen, A[๐’Š] must be smaller than every element of ๐’‚.
๏ƒจ ๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚ depends upon ๐’‚.
For example, if the smallest element of ๐’‚ has rank ๐’Œ in A, then
๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚ = ?? ๐’Œ − ๐Ÿ
๐’−๐’Š+๐Ÿ
Dependency on ๐’‚ makes it hard to calculate
๐’‚∈๐‘บ๐’Š−๐Ÿ
๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚
โˆ™ ๐(๐“”๐’‚ )
5
Backward analysis for
First ๐’Š elements
๐(๐‘ฟ๐’Š = ๐Ÿ)
A
1
2
Find-Min(A[1..๐’])
{ ๐’Ž๐’Š๐’ ๏ƒŸ A[1];
For ๐’Š = ๐Ÿ to ๐’ do
{ if (A[๐’Š] < ๐’Ž๐’Š๐’)
๐’Ž๐’Š๐’ ๏ƒŸ A[๐’Š] ;
}
return ๐’Ž๐’Š๐’;
}
…
๐’Š
๐’−๐Ÿ
Notations:
• ๐‘บ๐’Š : set of all subsets of A of size ๐’Š.
• For any ๐’‚ ∈ ๐‘บ๐’Š ,
๐“”๐’‚ : first ๐’Š elements of A are some
permutation of ๐’‚.
Using Partition Theorem,
๐(๐‘ฟ๐’Š = ๐Ÿ) = ๐’‚∈๐‘บ๐’Š ๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚ โˆ™ ๐(๐“”๐’‚ )
6
Backward analysis for
๐(๐‘ฟ๐’Š = ๐Ÿ)
๐’‚ : a subset of ๐’Š − ๐Ÿ elements.
๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚ =
“Given that first ๐’Š elements of A are some permutation of ๐’‚, what is prob.
that ๐‘ฟ๐’Š = ๐Ÿ ?”
For this event to happen, the smallest element of ๐’‚ must appear at A[๐’Š].
๏ƒจ ๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚ = ๐( “the smallest element? ?of ๐’‚ appear at A[๐’Š]” )
Fact: A is permuted randomly uniformly
๏ƒจ Every element of ๐’‚ is equally likely to appear at place A[๐’Š].
๐Ÿ
๏ƒจ ๐(๐‘ฟ๐’Š = ๐Ÿ ๐“”๐’‚ = ??
๐’Š
Same for each ๐’‚
7
Backward analysis for
First ๐’Š elements
๐(๐‘ฟ๐’Š = ๐Ÿ)
A
1
2
Find-Min(A[1..๐’])
{ ๐’Ž๐’Š๐’ ๏ƒŸ A[1];
For ๐’Š = ๐Ÿ to ๐’ do
{ if (A[๐’Š] < ๐’Ž๐’Š๐’)
๐’Ž๐’Š๐’ ๏ƒŸ A[๐’Š] ;
}
return ๐’Ž๐’Š๐’;
}
…
๐’Š
๐’−๐Ÿ
Notations:
• ๐‘บ๐’Š : set of all subsets of A of size ๐’Š.
• For any ๐’‚ ∈ ๐‘บ๐’Š ,
๐“”๐’‚ : first ๐’Š elements of A are some
permutation of ๐’‚.
Using Partition Theorem,
๐(๐‘ฟ๐’Š = ๐Ÿ) = ๐’‚∈๐‘บ๐’Š ๐(๐‘ฟ๐’Š =๐Ÿ๐Ÿ ๐“”๐’‚ โˆ™ ๐(๐“”๐’‚ )
=
๐Ÿ
๐’Š
๐Ÿ
๐’Š
๐’Š
๐’‚∈๐‘บ๐’Š
๐(๐“”๐’‚ )
= ⋅๐Ÿ
8
PROBLEM 2
CLOSEST PAIR OF POINTS
9
Closest Pair of Points
Problem Definition:
Given a set ๐‘ท of ๐’ > ๐Ÿ points in plane, compute the pair of points with
minimum Euclidean distance.
Randomized algorithm:
• O(๐’) : Randomized Incremental Construction based algorithm
10
๐’Šth iteration
Grid structure for first ๐’Š − ๐Ÿ points
๐œน๐’Š−๐Ÿ
๐œน๐’Š−๐Ÿ
11
Analysis of ๐’Šth iteration
Closest-pair-algorithm(๐‘ท)
Let <๐’‘๐Ÿ ,๐’‘๐Ÿ ,…,๐’‘๐’ > be a uniformly random permutation of ๐‘ท;
๐œน๐Ÿ ๏ƒŸ distance(๐’‘๐Ÿ ,๐’‘๐Ÿ );
๐‘ฎ ๏ƒŸ Build_Grid(๐œน๐Ÿ , {๐’‘๐Ÿ , ๐’‘๐Ÿ });
For ๐’Š = ๐Ÿ‘ to ๐’ do
{
Step 1: locate the cell of the grid ๐‘ฎ containing ๐’‘๐’Š ;
Step 2: find the point ๐’‘ ∈ {๐’‘๐Ÿ , … , ๐’‘๐’Š−๐Ÿ } closest to ๐’‘๐’Š ;
let ๐œน = distance(๐’‘, ๐’‘๐’Š );
Step 3: If ๐œน > ๐œน๐’Š−๐Ÿ
๐œน๐’Š ๏ƒŸ ๐œน๐’Š−๐Ÿ ; Insert(๐’‘๐’Š ,๐‘ฎ);
Else
๐œน๐’Š ๏ƒŸ ๐œน;
๐‘ฎ๏ƒŸ Build_Grid(๐œน, {๐’‘๐Ÿ , … , ๐’‘๐’Š });
}
return ๐œน๐’ ;
O(1)
O(1)
O(1)
๐’„๐’Š for constant ๐’„
12
running time of ๐’Šth iteration
๐‘ฟ๐’Š : running time of ๐’Šth iteration
O(1) + ๐’„๐’Š โˆ™ ๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ )
E[๐‘ฟ๐’Š ] = ??
Question: What is ๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ ) ?
13
Forward analysis for
๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ )
Closest-pair-algorithm(๐‘ท)
Let <๐’‘๐Ÿ ,๐’‘๐Ÿ ,…,๐’‘๐’ > be a uniformly random permutation of ๐‘ท;
๐œน๐Ÿ ๏ƒŸ distance(๐’‘๐Ÿ ,๐’‘๐Ÿ );
๐‘ฎ ๏ƒŸ Build_Grid(๐œน๐Ÿ , {๐’‘๐Ÿ , ๐’‘๐Ÿ });
For ๐’Š = ๐Ÿ‘ to ๐’ do
{
Step 1: locate the cell of the grid ๐‘ฎ containing ๐’‘๐’Š ;
Step 2: find the point ๐’‘ ∈ {๐’‘๐Ÿ , … , ๐’‘๐’Š−๐Ÿ } closest to ๐’‘๐’Š ;
let ๐œน = distance(๐’‘, ๐’‘๐’Š );
Step 3: If ๐œน > ๐œน๐’Š−๐Ÿ
๐œน๐’Š ๏ƒŸ ๐œน๐’Š−๐Ÿ ; Insert(๐’‘๐’Š ,๐‘ฎ);
Else
๐œน๐’Š ๏ƒŸ ๐œน;
๐‘ฎ๏ƒŸ Build_Grid(๐œน, {๐’‘๐Ÿ , … , ๐’‘๐’Š });
}
return ๐œน๐’ ;
14
Forward analysis for
๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ )
๐’‚ : a subset of ๐’Š − ๐Ÿ points from ๐‘ท.
๐“”๐’‚ :
๐œน๐’Š−๐Ÿ
first ๐’Š − ๐Ÿ points of ๐‘ท are some permutation of ๐’‚
๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ ๐“”๐’‚ = ??Depends upon ๐’‚
๐œน๐’Š−๐Ÿ
Calculating ๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ ) :
Let ๐‘บ๐’Š−๐Ÿ be the set of all subsets of ๐‘ท of size ๐’Š − ๐Ÿ.
๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ )=
๐’‚∈๐‘บ๐’Š ๐(๐œน๐’Š
< ๐œน๐’Š−๐Ÿ ๐“”๐’‚ โˆ™ ๐(๐“”๐’‚ )
Grid structure for first ๐’Š − ๐Ÿ points
15
Backward analysis for
๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ )
Closest-pair-algorithm(๐‘ท)
Let <๐’‘๐Ÿ ,๐’‘๐Ÿ ,…,๐’‘๐’ > be a uniformly random permutation of ๐‘ท;
๐œน๐Ÿ ๏ƒŸ distance(๐’‘๐Ÿ ,๐’‘๐Ÿ );
๐‘ฎ ๏ƒŸ Build_Grid(๐œน๐Ÿ , {๐’‘๐Ÿ , ๐’‘๐Ÿ });
For ๐’Š = ๐Ÿ‘ to ๐’ do
{
Step 1: locate the cell of the grid ๐‘ฎ containing ๐’‘๐’Š ;
Step 2: find the point ๐’‘ ∈ {๐’‘๐Ÿ , … , ๐’‘๐’Š−๐Ÿ } closest to ๐’‘๐’Š ;
let ๐œน = distance(๐’‘, ๐’‘๐’Š );
Step 3: If ๐œน > ๐œน๐’Š−๐Ÿ
๐œน๐’Š ๏ƒŸ ๐œน๐’Š−๐Ÿ ; Insert(๐’‘๐’Š ,๐‘ฎ);
Else
๐œน๐’Š ๏ƒŸ ๐œน;
๐‘ฎ๏ƒŸ Build_Grid(๐œน, {๐’‘๐Ÿ , … , ๐’‘๐’Š });
}
return ๐œน๐’ ;
16
Backward analysis for
๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ )
๐’‚ : a subset of ๐’Š points from ๐‘ท.
๐“”๐’‚ : first ๐’Š points of ๐‘ท are some permutation of ๐’‚
๐œน๐’Š
๐Ÿ
๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ ๐“”๐’‚ = ??
๐’Š
Calculating ๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ ) :
Let ๐‘บ๐’Š be the set of all subsets of ๐‘ท of size ๐’Š.
๐œน๐’Š
๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ )=
๐’‚∈๐‘บ๐’Š ๐(๐œน๐’Š
=
๐’‚∈๐‘บ๐’Š
๐Ÿ
Grid structure for first ๐’Š points
=๐’Šโˆ™
๐’‚∈๐‘บ๐’Š
๐Ÿ
๐’Š
< ๐œน๐’Š−๐Ÿ ๐“”๐’‚ โˆ™ ๐(๐“”๐’‚ )
โˆ™ ๐(๐“”๐’‚ )
๐(๐“”๐’‚ )
=
๐Ÿ
๐’Š
17
running time of ๐’Šth iteration
๐‘ฟ๐’Š : running time of ๐’Šth iteration
E[๐‘ฟ๐’Š ] = O(1) + ๐’„๐’Š โˆ™ ๐(๐œน๐’Š < ๐œน๐’Š−๐Ÿ )
= O(1) + ๐’„๐’Š โˆ™
๐Ÿ
๐’Š
= O(1)
Expected running time of the algorithm :
E[๐‘ฟ๐’Š ]
๐’Š≤๐’
=
O(1)
= O(๐’)
๐’Š≤๐’
Theorem:
There exists a linear time Las Vegas algorithm to compute closest pair of
points in plane.
18
RANDOMIZED INCREMENTAL
CONSTRUCTION
19
Randomized Incremental Construction
• Permute the elements of input randomly uniformly.
• Build the structure incrementally.
• Keep some data structure to perform ๐’Šth iteration efficiently.
• Use Backward analysis to analyze the expected running time.
20
Randomized Incremental Construction
• Convex Hull of a set of points
• Trapezoidal decomposition of a set of segments.
• Convex polytope of a set of half-planes
• Smallest sphere enclosing a set of points.
• Linear programming in finite dimensions.
21
PROBLEM 3
CONVEX HULL OF POINTS
22
Convex hull of Points
Problem definition:
Given ๐’ points in a plane, compute a convex polygon of smallest area that
encloses all the points.
23
Convex hull of Points
Deterministic algorithm:
• O(๐’ ๐ฅ๐จ๐  ๐’) time algorithm.
• Many algorithms exist:
Grahams Scan, Jarvis’s march, divide and conquer,…
Randomized algorithm:
• O(๐’ ๐ฅ๐จ๐  ๐’) time algorithm.
• Based on Randomized Incremental Construction.
• Generalizable to higher dimensions.
24
Randomized algorithm for convex hull
Convex-hull-algorithm(๐‘ท)
{
Let <๐’‘๐Ÿ ,๐’‘๐Ÿ ,…,๐’‘๐’ > be a uniformly random permutation of ๐‘ท;
๐‘ฏ๏ƒŸ triangle(๐’‘๐Ÿ ,๐’‘๐Ÿ , ๐’‘๐Ÿ‘ );
For ๐’Š = ๐Ÿ’ to ๐’ do
insert ๐’‘๐’Š and update ๐‘ฏ
return ๐‘ฏ;
}
25
A simple exercise from geometry
Exercise: Given a line L and two points p and q, determine whether the
points lie on the same/different sides of L.
L
p
q
q
๐’š = ๐’Ž๐’™ + ๐’„
26
Conflict graph : a powerful data structure
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
27
Before entering the for loop
28
Before entering the for loop
๐’ − ๐Ÿ‘ points
cones
๐’„๐Ÿ
๐’„๐Ÿ
๐’„๐Ÿ
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ‘
29
INSERTING ๐’ŠTH POINT
30
๐’Šth iteration
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ”
31
๐’Šth iteration
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
32
๐’Šth iteration
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
33
๐’Šth iteration
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
34
๐’Šth iteration
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
35
๐’Šth iteration
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
36
๐’Šth iteration
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
37
๐’Šth iteration
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
38
๐’Šth iteration
๐’„๐Ÿ
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„๐Ÿ‘
๐’„๐Ÿ
๐’„๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’„๐Ÿ’
๐’„๐Ÿ“
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„๐Ÿ“
๐’„๐Ÿ–
๐’„๐Ÿ”
39
๐’Šth iteration
๐’ − ๐’Š points
๐’„๐Ÿ
cones
๐’„๐Ÿ
๐’„๐Ÿ–
๐’„′
๐’„′
๐’„"
๐’„๐Ÿ”
๐’„๐Ÿ•
๐’„"
๐’„๐Ÿ•
๐’„๐Ÿ–
๐’„๐Ÿ”
40
Running time of ๐’Šth iteration
Running time of ๐’Šth iteration is of the order of
• Number of edges destroyed
Total time for ๐’ iterations = O(๐’)
• Number of new edges created
• Number of points in the two adjacent cones that get created
๐‘ฟ๐’Š
Question: What is the max. number of new edges created in an iteration ?
Answer: 2
๏ƒจ Number of edges created during the algorithm = O(๐’)
Since every edge destroyed was once created, so
Total number of edges destroyed < Total number of edges decreated
41
Backward analysis of ๐’Šth iteration
๐’‚ : a subset of ๐’Š points from ๐‘ท.
๐“”๐’‚ : first ๐’Š points of ๐‘ท are some
permutation of ๐’‚
๐„[๐‘ฟ๐’Š ๐“”๐’‚ = ??
42
Backward analysis of ๐’Šth iteration
๐’„๐Ÿ
๐’„๐Ÿ–
๐’‚ : a subset of ๐’Š points from ๐‘ท.
๐“”๐’‚ : first ๐’Š points of ๐‘ท are some
permutation of ๐’‚
๐’„๐Ÿ
๐’‘๐Ÿ
๐’‘๐Ÿ–
๐’„๐Ÿ‘
๐’‘๐Ÿ
๐’‘๐Ÿ•
๐„[๐‘ฟ๐’Š ๐“”๐’‚ = ??
๐’‘๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’‘๐Ÿ’
๐’‘๐Ÿ”
๐’‘๐Ÿ“
๐’„๐Ÿ“
๐’„๐Ÿ”
43
Backward analysis of ๐’Šth iteration
๐’„๐Ÿ
๐’„๐Ÿ–
๐’‚ : a subset of ๐’Š points from ๐‘ท.
๐“”๐’‚ : first ๐’Š points of ๐‘ท are some
permutation of ๐’‚
๐’„๐Ÿ
๐’‘๐Ÿ
๐’‘๐Ÿ–
๐’„๐Ÿ‘
๐’‘๐Ÿ
๐’‘๐Ÿ•
๐„[๐‘ฟ๐’Š ๐“”๐’‚ = ??
๐’‘๐Ÿ‘
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’‘๐Ÿ’
๐’‘๐Ÿ”
๐’‘๐Ÿ“
๐’„๐Ÿ“
๐’„๐Ÿ”
44
Backward analysis of ๐’Šth iteration
๐’„๐Ÿ
๐’„๐Ÿ–
๐’‚ : a subset of ๐’Š points from ๐‘ท.
๐“”๐’‚ : first ๐’Š points of ๐‘ท are some
permutation of ๐’‚
๐’„๐Ÿ
๐’‘๐Ÿ
๐’‘๐Ÿ–
๐’„๐Ÿ‘
๐’‘๐Ÿ
๐’‘๐Ÿ•
๐’‘๐Ÿ‘
Calculating ๐„[๐‘ฟ๐’Š ] :
๐’„๐Ÿ’
๐’„๐Ÿ•
๐’‘๐Ÿ’
๐’‘๐Ÿ”
๐’‘๐Ÿ“
๐’„๐Ÿ”
๐„[๐‘ฟ๐’Š ๐“”๐’‚ = ??๐Ÿ(๐’ − ๐’Š)
๐’Š
๐’„๐Ÿ“
Let ๐‘บ๐’Š be the set of all subsets of
๐‘ท of size ๐’Š.
๐„[๐‘ฟ๐’Š ] =
=
=
๐’‚∈๐‘บ๐’Š ๐„[๐‘ฟ๐’Š
๐’‚∈๐‘บ๐’Š
๐Ÿ(๐’−๐’Š)
๐’Š
๐“”๐’‚ โˆ™ ๐(๐“”๐’‚ )
๐Ÿ(๐’−๐’Š)
โˆ™
๐’Š
๐(๐“”๐’‚ )
45
Running time of the algorithm
Expected running time of ith iteration
= ๐„[๐‘ฟ๐’Š ] + O(1)
= O(
๐’−๐’Š
)
๐’Š
Expected running time of the algorithm = O(๐’ ๐ฅ๐จ๐  ๐’ )
Theorem:
There is an O(๐’ ๐ฅ๐จ๐  ๐’ ) time Las Vegas algorithm for computing convex hull.
46
47
Download