Software Engineering Personal Assignment 05 (two-dimensional array to find the maximum number of sub-arrays)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.