This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: COMP 271H Design and Analysis of Algorithms 2006 Fall Semester Reference material 2 Maximal Subrectangle Problem 1. Introduction: This article focuses the 2dimensional extension of linear contiguous subarray problem. The problem is that given a N × N square blocks, with total N 2 blocks, find the sub rectangle from this square blocks such that the sum is maximal among all possible rect angles. For example, given the 4 × 4 square blocks 2 7 9 2 6 2 4 1 4 1 1 8 2 The maximal subrectangle should locate at 9 2 4 1 1 8 with the sum equals to 15. 2. The way to solve this problem: First, we need to think what is the performance to solve it in brute force. We will count number of subrectangles for N = 1, N = 2 and N = 3 respectively. Size of N N = 1 N = 2 N = 3 Number of subrectangles 1 9 36 Value of N 2 1 4 9 Value of N 3 1 8 27 Using this simple analysis, we can guess that the number of subrectangles will at least grow in O ( N 3 ) time (Just a rough guess). Also, in the worst case, we need to sum a rectangle in O ( N 2 ) time. So, the brute force algorithm may run in at least) time....
View
Full
Document
This note was uploaded on 12/09/2010 for the course ENGLISH 1303 taught by Professor May during the Spring '10 term at HKU.
 Spring '10
 may
 English

Click to edit the document details