CodePudding user response:
Is in the array to find the largest number kCodePudding user response:
1, create a new array int * b=new int [n].2, to the array b assignment memcpy (b, a, sizeof (int) * n);
3, to sort an array b, from big to small by the (code), in order to save operation time and reasonable use simple when ordering just need number k before discharge, namely double loop outer ring only need from 1 to k, without the need to n,
4, take note of the output results int r=b (k - 1),
5, destroyed just application memory delete [] b;
6, return the result return r;