Randomized Incremental Algorithm
Introduction
Randomized incremental algorithm is an important algorithm in computational geometry. It requires minimal theoretical knowledge, has low time complexity, and is widely applicable.
The idea of the incremental algorithm is similar to the principle of mathematical induction. Its essence is to reduce a problem to a subproblem of exactly one smaller size. After solving the subproblem, the current object is added. Expressed recursively:
The incremental algorithm has a concise form and can be applied to many geometric problems.
The incremental algorithm is often combined with randomization to avoid worst-case scenarios.
Minimum Enclosing Circle Problem
Problem Description
Given \(n\) points on a plane, find the circle with the smallest radius that can cover all points.
Process
Assume circle \(O\) is the minimum enclosing circle for the first \(i-1\) points. When adding the \(i\)-th point, if it lies inside or on the circle, do nothing. Otherwise, the new minimum enclosing circle must pass through the \(i\)-th point.
Then, using the \(i\)-th point as the base (with radius \(0\)), repeat the above process by adding the \(j\)-th point. If the \(j\)-th point lies outside the circle, the minimum enclosing circle must pass through the \(j\)-th point.
Repeat the above steps. (Since at most three points are needed to determine the minimum enclosing circle, repeat three times.)
After traversing all points, the resulting circle is the minimum enclosing circle covering all points.
Properties
Time Complexity: \(O(n)\). For proof, refer to the references.
Space Complexity: \(O(n)\)
Implementation
Code Implementation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
Practice
References and Further Reading
Randomized Incremental Algorithm - Xie Yilun
https://www.cnblogs.com/aininot260/p/9635757.html
https://www.cise.ufl.edu/~sitharam/COURSES/CG/kreveldnbhd.pdf
https://blog.csdn.net/u014609452/article/details/62039612
本页面最近更新:,更新历史
发现错误?想一起完善? 在 GitHub 上编辑此页!
本页面贡献者:OI-wiki
本页面的全部内容在 CC BY-SA 4.0 和 SATA 协议之条款下提供,附加条款亦可能应用