Question
-Can you please write this assignment as a program in java: Given an array (m x n) of positive integers, find, in (mn) time, the
-Can you please write this assignment as a program in java:
Given an array (m x n) of positive integers, find, in (mn) time, the maximum size square submatrix such that all values of the submatrix are larger than a given input k. For example, consider the following matrix
82 10 16 15 66
91 28 98 43 4
13 55 96 92 85
92 96 49 80 94
64 97 81 96 68
When k=3, the maximum submatrix is the entire matrix.
When k = 10, the maximum submatrix size is 4x4 with with (5,4)-th entry being the bottom right corner.
When k = 20, the maximum submatrix size is 3x3. There are three such submatrices whose bottom right corner coordinates are (4,4), (5,4), and (5,5), respectively.
When k = 50, the maximum submatrix size is 2x2. There are three such submatrices whose bottom right corner coordinates are (4,5), (5,2), and (5,5), respectively.
When k = 70, the maximum submatrix size is 2x2 with (4,5) being its bottom right corner coordinates.
Input: a text file of the integer matrix as in the above example, and a value k given by a user using the keyboard.
Output: the size of the maximum submatrix and the coordinates of the bottom right corner(s). In the above example for k=20, the output would be
3
4 4
5 4
5 5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started