Home /
Expert Answers /
Other /
3-create-a-class-node-that-contains-a-random-value-50-lt-x-lt-50-create-a-2-d-array-size-m-n-entered

3.Create a class node that contains a random value -50<x<50, Create a 2-d array (size m, n entered by the user ) of these random nodes find the internal square with the largest sum of values within it. For example if the user enters m = 4, and n=3 and values are generated it might look like this

-324-168

-2 5-2211

5-10312

335-17-33

You might think the maximum sub-matrix would be

-25

5-20

335 sum =26

But it is actually

8

11

12 sum =31 you need to check all possible rectangles, this is a 2d version of

the greatest common substring problem.

-324-168

-2 5-2211

5-10312

335-17-33

You might think the maximum sub-matrix would be

-25

5-20

335 sum =26

But it is actually

8

11

12 sum =31 you need to check all possible rectangles, this is a 2d version of

the greatest common substring problem.

#include <iostream>#include <vector>#include <iomanip>#include <cstdlib>using namespace