for(int i=0; i<n-1; i++) { for(int j=i+1; j<n; j++) { if(a[i] > a[j]) { } } }
PS Given the name of the algorithm, you can easily find the appropriate source code. But it's hard for me to do the opposite: D
Change Oh! If it is a sorting of bubbles, then what is it called:
for(int i=0; i<n; i++) { for(int j=0; j<n-1; j++) { if(a[j] > a[j+1]) { } } }
I thought this second βbubbleβ reduces the number of elements, so I thought it was really a bubble. If the first type of bubbles, what is the name of the second?
sorting algorithm
user529141
source share