Class 5 - 2D Maxima Sweep-Line Algorithm
Class 5 - 2D Maxima Sweep-Line Algorithm
Algorithm
(Class 5)
= 𝑶𝑶 𝒏𝒏 𝒍𝒍𝒍𝒍𝒍𝒍𝟐𝟐 𝒏𝒏
Comparison
• How much of an improvement is plane-sweep over brute-force?
• Ratio of running times:
𝑛𝑛2
𝑛𝑛 log 2 𝑛𝑛
𝑛𝑛
=
log 2 𝑛𝑛
n log n Ratio (n/log n)
100 7 15
1000 10 100
10000 13 752
100000 17 6021
1000000 20 50171
• For example, if we have n = 1000000,
• The plane-sweep algorithm will take 1 second.
• The brute-force algorithm will take about 14 hours.