Title: Returns the number of the largest interconnected subarray in a two-dimensional integer array.
Requirements: Enter a two-dimensional shape array with positive and negative numbers in the array.
The maximum value for the and of all sub-arrays. Requires a time complexity of O (n).
The array to be used by the program is placed in a file called Input.txt, and the file format is:
The number of rows in the array,
The number of columns in the array,
The elements of each row (separated by commas)
Each number is a signed 32-bit integer, and of course, the number of rows and columns is a positive integer.
Program Design ideas: This test takes into account the need to require maximum connectivity sub-arrays and. You can define a class (where there are value,x,y,neighbor,select) and define a two-dimensional object in the main function as follows:
A: In a two-dimensional object, all positive numbers are selected first, and their select values are assigned to 1.
B: Assigns the select value of the orphaned number to 0 and excludes those that affect the connectivity of the Subarray.
C: Determine which positive neighboe value is 1, if all the neighbor in the two-dimensional object is worth more than 3, then select the point in addition to the edge point, write down his coordinate value.
D: For the "alternative number" in the previous step, select one of his "neighbors", making the sub-array a unicom. The select value of the object in the selected sub-array is 1.
E: Finally, the number of the value of the select value of 1 in all objects is calculated. This value is the same as the two-dimensional maximum connectivity sub-array.
The program is still under development .....
Software Engineering Personal Assignment 05 (two-dimensional array to find the maximum number of sub-arrays)