Question: Let A be an N-by-N matrix of zeros and ones. A submatrix S of A is any group of contiguous entries that forms a square.

Let A be an N-by-N matrix of zeros and ones. A submatrix S of A is any group of contiguous entries that forms a square.
a. Design an O(N2) algorithm that determines the size of the largest submatrix of ones in A. For instance, in the matrix that follows, the largest submatrix is a 4-by-4 square.
10111000
00010100
00111000
00111010
00111111
01011110
01011110
00011110
b. Repeat part (a) if S is allowed to be a rectangle instead of a square. Largest is measured by area.

Step by Step Solution

3.52 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a A simple dynamic programming algorithm in which we scan in row order suffices ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

1486-C-S-A(553).docx

120 KBs Word File

Students Have Also Explored These Related Algorithms Questions!