Lecture 16: Randomized Incremental Construction

Download Report

Transcript Lecture 16: Randomized Incremental Construction

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