Home > Back-end >  Sort an array
Sort an array

Time:06-10

Why the run wrong

CodePudding user response:

Put a [k]=(a [k] & gt; A [j])? A [j] : a, [k]. Change
K=(a [k] & gt; A [j])? J: k;
K hasn't been changed, you will never walk into k!=I, and a [k]=(a [k] & gt; A [j])? A [j] : a, [k]. Will also change a [I] value (for k=I)

CodePudding user response:

reference 1st floor qybao response:
a [k]=(a [k] & gt; A [j])? A [j] : a, [k]. Change
K=(a [k] & gt; A [j])? J: k;
K hasn't been changed, you will never walk into k!=I, and a [k]=(a [k] & gt; A [j])? A [j] : a, [k]. Will also change a [I] value (for k=I)

Thank you bosses know about

CodePudding user response:

The second sort loop statements change into:

 k=a [k] & gt; A [j]? J: k; 

Other remains unchanged,

Main such directly to a [k] the assignments can lead to a value to cover before [k], resulting in more of the same values,

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related