Efficient algorithms for the largest rectangle problem

Abstract In this paper, we present some efficient algorithms for the largest rectangle problem. The problems considered are the following. Problem P1: Given a bounding isothetic rectangle R and a point set S inside it, we have to find out the largest area (perimeter) isothetic rectangle inside R such that it does not contain any point from the set S . Problem P2: Given an isothetic polygon R , we have to find out the largest area (perimeter) rectangle completely contained in R . Problem P3: Same as problem P2, but isothetic holes are allowed inside the polygon R . We present algorithms that run in O ( nlogn + K ) time for all three problems. Where n is the cardinality of the set S in problem P1 and the number of sides of the polygon R and holes in problems P2 and P3. K is the number of candidate rectangles for a problem instance. The value of K is O ( nlogn ) on an average. So, our algorithms run in O ( nlogn ) time in the expected case. But the worst-case running time is O ( n 2 ). We also present optimal O ( n ) time systolic algorithms for all three problems. For problem P1, we present an efficient O ( nlogn ) time algorithm on a tree of processors.