Question #186503

Consider Following list of elements, Show arrangement of elements until four numbers of iterations

while applying Selection, Insertion, and Bubble Sort Algorithms.

2, 6, 1, 8, 9, 7, 10, 24


Expert's answer

Sort the series by selection sort:

arr[] = 2, 6, 1, 8, 9, 7, 10, 24

// Find the minimum element in arr[0...7]
// and place it at beginning
1, 6,2,8, 9, 7, 10, 24

// Find the minimum element in arr[1...7]
// and place it at beginning of arr[1...7]
1, 2,6,8, 9, 7, 10, 24

// Find the minimum element in arr[2...7]
// and place it at beginning of arr[2...7]
1, 2,6,8, 9, 7, 10, 24

// Find the minimum element in arr[3...7]
// and place it at beginning of arr[3...7]
1, 2,6,7, 9, 8, 10, 24

// Find the minimum element in arr[4...7]
// and place it at beginning of arr[4...7]
1, 2,6,7, 8, 9, 10, 24

// Find the minimum element in arr[5...7]
// and place it at beginning of arr[5...7]
1, 2,6,7, 8, 9, 10, 24

// Find the minimum element in arr[6...7]
// and place it at beginning of arr[6...7]
1, 2,6,7, 8, 9, 10, 24

// Find the minimum element in arr[7...7]
// and place it at beginning of arr[7...7]

1, 2,6,7, 8, 9, 10, 24

LATEST TUTORIALS
APPROVED BY CLIENTS