Home > Back-end >  The sorting
The sorting

Time:09-21

Using c + + to the smallest non-zero, put is zero to the final?

CodePudding user response:

Pick out the 0, then quick sort of non-zero

Can also be modified directly implement quick sort code

CodePudding user response:

After the sort sorting, record the number of zero, in front of the output

CodePudding user response:

A scan of the array, the 0 and tail from the first array of non-zero exchange, and record the Numbers of 0,
On the front of the array (the number of total number 0) elements to sort,
  • Related