A Experimental topics:
Returns the and of the largest sub-array in an integer array.
Two Experimental requirements:
Enter an array of shapes with positive and negative numbers in the array.
One or more consecutive integers in an array make up a sub-array, each of which has a and.
Requires that the procedure be capable of handling 1000 elements;
Each element is of the int32 type;
The maximum value for the and of all sub-arrays.
Three Experimental ideas:
This experiment was improved on the basis of the last time, it seems that the need to improve at the beginning of the place is not small, but carefully think about it, really difficult. Handles 1000 elements, is prone to memory overflow, and then each element is of type int32, which is easy for data overflow. The experiment focused on solving the problem.
For the previous deal with 1000 elements of the problem, in fact, there is no idea, do not know how to deal with this problem;
For each of the latter elements is the Int32 type, each time the two numbers are added together, the last 16 bits and the last 16 bits are added, the first 16 bits and the first 16 bits are added and the last 16 bits add the carry. Four Experiment Summary:
The experiment teacher mainly asked to write ideas, see this problem when we first think of is Zhang Tixiao teacher, because before we in the computer introduction, Zhang Teacher gave us a problem, let us calculate factorial, if the value of n is very large, we should how to solve this problem, Think at the beginning we are very naïve to think that teachers despise our IQ, so simple problem with a loop enough to solve all the problems, but the real practice is not like that ...
Today, my teammates and I met once again the same problem, but this time we are very heavy from the beginning of the mood, because know that the experiment itself is not to do, the results met again, it is not a little bit of frustration two o ' ah.
For memory overflow, the idea of the big gods is to expand the number of machines, or can not be achieved;
For data overflow, the above is a thought, here a lot of words to be omitted ...
How the and overflow of the largest subarray in an integer array is handled