Exercises 28—35 refer to selection sort, which is another algorithm to arrange the items in an array in ascending order.
Algorithm 11.3.2 Selection Sort
(Given an array
if
kth step: Find the index of the array element with minimum value from among
33. When selection sort is applied to the array of exercise 29. how many times is the comparison in the if-then statement performed?
To find the no of total comparison between
From the given
Initially given 5 elements and 5 is assigned to n. Initially set k to 1,Index of Min to
First step to compare