### Computing the Largest Empty Rectangle

B. Chazelle, R. L. Drysdale, D. T. Lee
1986 SIAM journal on computing (Print)
We consider the following problem: Given a rectangle containing N points, find the largest area subrectangle with sides parallel to those of the original rectangle which contains none of the given points. If the rectangle is a piece of fabric or sheet metal and the points are flaws, this problem is finding the largest-area rectangular piece which can be salvaged. A previously known result [13] takes O(N2) worst-case and O(N log N) expected time. This paper presents an O(N log N) time, O(N log
more » ... N) time, O(N log N) space algorithm to solve this problem. It uses a divide-and-conquer approach similar to the ones used by Bentley [1] and introduces a new notion of Voronoi diagram along with a method for efficient computation of certain functions over paths of a tree. 1. Introduction. We consider the following problem: Given a rectangle containing n points, find the largest area subrectangle with sides parallel to those of the original rectangle which contains none of the given points. If the rectangle is a piece of fabric or sheet metal and the points are flaws, this problem is finding the largest-area rectangular piece which can be salvaged. The special case in which a largest empty square is desired has been solved in O(n log n) time using Voronoi diagrams in Ll-(L-)metric [7], [12] , which is just a variation of the largest empty circle problem studied by Shamos [14], [15]. In [13] an O(n2) worst-case and O(n log 2 n) expectedtime algorithm is presented for the largest empty rectangle problem. Other related problems can be found in [3], [5]. This paper presents an O(n log n) time, O(n log n) space algorithm to solve this problem. It uses a divide-and-conquer approach similar to the ones used by Bentley 1 ]. 2. General approach. We first note that the largest area rectangle with sides parallel to the bounding rectangle will have each edge supported by either an edge of the bounding rectangle or by at least one of the given points. (If the set of points contains two or more points lying on a vertical or horizontal line, an edge of the largest rectangle may be supported by more than one point.) Any rectangle is uniquely determined by its four supports (points or edges of the bounding rectangle). Therefore a naive algorithm could choose quadruples of support and then test to see if any points lie inside the rectangle formed. This method requires O(n5) time. However, it is shown in [13] that the number of such empty rectangles is at most O(n2) and that by carefully maintaining those rectangles the one with the largest area can be found in O(tl2) time. We shall in this paper present a divide-and-conquer algorithm. Let Pl, P2," ",P, be the n points sorted by x-coordinate and Xmin, Xmax, Ymin, and Ymax be the boundaries of the bounding rectangle. Let the coordinates of point Pi be (xi, Yi). Our algorithm splits the points into two halves by x-coordinate. We recursively solve the problem for the sets S {Pl," Pln/2]} and \$2 {P[n/21+," Pn}. (The bounding rectangles of these recursive calls must be adjusted. The right boundary for the left call is xt"/2 and the left boundary for the right call is Xln/2j/l.) These calls determine the largest *