Software Engineering class Assignment (10)--pair Development (v)

Source: Internet
Author: User

First, title and requirements:

Title: Returns the maximum number of sub-arrays in an integer array and

Request (ADD): ① input A two-dimensional array of shaping, there are positive numbers in the array and negative values; ② two-dimensional arrays end-to-end, like a tape that meets the end-to-end.

Pair of people: Jiao Yanhu

Second, design ideas:

This topic is actually the combination of two-dimensional array and ring array, in order to solve this problem, the previous two problems can be fused.

First, solve the problem of finding the largest sub-array in two-dimensional array, then follow the method of one-dimensional array, put the first column in the last column, find out the maximal sub-array of the new two-dimensional array, and find out the maximal subarray of each two-dimensional array in turn.

Third, part of the source code:

1  for(m=0;m<5; m++)2 {3      for(cw1=0;cw1<3; cw1++)//Save the first column.4     {5flag[cw1]=a[cw1][0];6     }7      for(lie=0;lie<4; lie++)//starting from the second column, the value of each column equals the element behind it8     {9          for(hang=0;hang<3; hang++)Ten         { OneA[hang][lie]=a[hang][lie+1]; A         } -     } -      for(cw2=0;cw2<3; cw2++)//the value of the last column is the first column that was just saved the     { -a[cw2][4]=FLAG[CW2]; -     } -}

Four, Experience:

Software Engineering class Assignment (10)--pair Development (v)

Related Article

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.