Second job: subarray and maximum continuous (and largest sub-segment)

District public information work

From the beginning of this work invites all students will work on the beginning of the following table centered

Blog information Shenyang Aerospace University School of Computer Science 2020 software engineering work
Work requirements https://edu.cnblogs.com/campus/sau/Computer1701-1705/homework/10583
Course objectives Familiar with the development process a "high-quality" software
Jobs goal Unit Testing Practice

And the maximum continuous subarray (maximum and sub-segment)
Background

Problem: Given n integer (possibly negative) consisting of a sequence of a [1], a [2 ], a [n] a [3], ...,, find the sequence, such as a [i] + a [i + 1] + ... + a [j ] and the maximum value of the sub-segments. When given definitions are negative integer and sub-segment 0, so defined, the required optimal values: Max {0, a [i ] + a [i + 1] + ... + a [j]} , 1 <= i <= j <= n
For example, when (a [1], a [ 2], a [3], a [4], a [5], a [6]) = (- 2, 11, -4,13, -5, -2), and the maximum of 20 sub-segment.
- quote from the " Baidu Encyclopedia "

Source address: https: //github.com/lssworrior/-/create/master/%E4%BB%A3%E7%A0%81

Test code address: https: //github.com/lssworrior/-/blob/master/main.cpp

Test Results:

 

 

 

 

Selection determining / coverage condition test

 

Record results 0
date 2020.4.8
Starting time 8:30
End Time 10:50
Coding the number of rows 37
The number of errors 2
Error 1 Ill-considered negative to positive
Error 1 Modified 10

Guess you like

Origin www.cnblogs.com/warriorlss/p/12663272.html
Recommended