Here is an array of 10 integers. 5 3 8 1 7 0 2 6 4. Draw this array after the first iteration of the large loop in a selection sort (Sorting from smallest to largest)
The first array element and the last of the array elements that are smaller than the first one will be swapped at the first iteration of the large loop in a selection sort (sorting from smallest to largest). Thus, the first array element (5) and the last one (4) will be swapped. The new array will be 4 3 8 1 7 0 2 6 5.
Comments
Leave a comment