Computer Science Homework Solutions
Problem
#154009

Write a C++ program to find the biggest submatrix of an n*m matrix containing only 0 and 1 values, in which all the values are 0s.

Write a C++ program to accept an n*m matrix containing only 0 and 1 values, and then find it's biggest zero submatrix i.e. the biggest submatrix in which all the values are 0.

INPUT

First line contains two numbers n, m (n,m<=300),
then n lines, each having m 0/1 digits.

OUTPUT

One number, which represent the number of zeros inside the biggest zero submatrix.


SAMPLE INPUT

6 5
0 0 0 0 0
0 1 1 1 0
0 1 0 1 0
0 1 1 1 0
0 0 0 0 0
0 0 0 0 0

SAMPLE OUTPUT

10


Solution Summary

Solution implements a brute force logic using recursion that redundantly evaluates many submatrices multiple times. Code compiles error and warning free with "g++ -Wall -ansi" (g++ version 3.3.1 on cygwin) and has been tested for execution with given sample input as well as various base case permutations of 1x1 and 2x2 matrices.

Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$15.96)
Included in Download
  • Plain text response
  • Attached file(s):
    • 154009.cpp
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
Browse