Here, an algorithm that, given the radius r > 0 and the approximation constant c > 0 , returns a circle of radius (1+c) r covering at least k points, or announces that there is no circle of radius r strictly covering at least k points. The running time is O(n (1 + k^-1 c^-2 log c^-1)) , which when used in conjunction with a binary search to get a fairly rough estimate should be faster than the tmyklebu algorithm. (To initialize the search, it is possible, during O(n^2) to obtain a 2 approximation for r by cycling through the points and run quickselect to find k th the nearest other point.)
Separate the points by placing the point (x, y) in a square cell labeled (floor(x/(2r)), floor(y/(2r))) . Each circle of radius r has an inner part that overlaps no more than four boxes. If there exists a circle of radius r spanning at least k points, then there exist i, j such that bins (i, j), (i, j+1), (i+1, j), (i+1, j+1) together have at least k points.
For each of these subtasks, place each participating point (x, y) in the cell of the smaller square, (floor(x/w), floor(y/w)) , where w = cr/(3sqrt(1/2)) is enough small width. Now prepare the matrix O(c^-1) by O(c^-1) , where each entry indicates how many points are contained in the corresponding bin. Collapse this matrix in two dimensions with a zero matrix denoting cells that are completely contained in a circle of radius (1+c)r . The last matrix may look like
01110 11111 11111 11111 01110.
Now we know for each center of the grid a number that is limited by how many points a circle of radius r will contain and limited by how many points a circle of radius (1+c) r will contain.
source share