Set of points, the points closest to each other Given a set of points in a x and y coordinates, find the pairs of points (x1, y1) (x2, y2) that are closest . Algorithm will be used plane sweep and data structure will be 2-4 tree. d - minimum distance between the so-far found closest points. p is current point. D is the ordered set of points present in strip. Remove the points further than d to the left of p from the ordered set D that is storing the points in the strip. Determine the point on the left of p that is closest to it If the distance between this point and p is less than d (the current minimum distance), then update the closest current pair and d . Algorithm given http://www.cs.mcgill.ca/~cs251/ClosestPair/ClosestPairPS.html 2-4 tree link is http://www.cs.mcgill.ca/~cs251/ClosestPair/2-4trees.html.
Collection of Interview Question on Data structure, Algorithm, Java, C++ and more