0
Insertion sort algorithm
is this code snippet correct a [5]=[4,2,6,1,10] for (i=0; i <n; i++) { for (j=i+1; j <n; j++) { if (a [i]>a [j]) { swap a [i] & a [j] } } }
1 Respuesta
+ 1
This looks more like a bubble sort.
Insertion sort would find the smallest element first, put it in the first position in the list, then cycle over the remaining element and repeat.