0

Is there any known algorithm to solve this ?

1 Answers1

1

There's a related problem that's solvable with a greedy algorithm: given the points and a radius, find the minimum number of circles. This algorithm repeatedly places a circle whose left edge lies on the leftmost uncovered point, running in time O(n) on points sorted by x.

To get an algorithm for the requested problem, sort the points once and then use binary search to find the least radius that will result in at most d circles. Assuming that the x coordinates can be represented by machine words, this should be fine. (If not, there are other algorithms.)

David Eisenstat
  • 64,237
  • 7
  • 60
  • 120
  • @Blender He is suggesting you to use binary search on answer and I agree with him. Similar to this questions: [link](http://stackoverflow.com/questions/40189551/arrange-n-items-in-k-nonempty-groups-such-that-the-difference-between-the-minimu/40205972#40205972) and [link](http://stackoverflow.com/questions/39673898/divide-array-into-k-contiguos-partitions-such-that-sum-of-maximum-partition-is-m/39675098#39675098) – Saeid Nov 02 '16 at 00:24