Answer:
list = {10, 18, 24, 75, 70, 20, 60, 35}
Explanation:
In selection sort 1st element of array is compared with all elements in list. If there is any element smaller than any other element in the list, that will be swap with first element as
1st iteration:
in given list first element is 24, this will compare with whole list and find the number that is smaller than any other element in list. there 10 is smallest element in the list so in first iteration the list is given as:
list = {10 , 20, 24, 75, 70, 18, 60 ,35}
2nd Iteration:
After first iteration the smallest element of list will comes at first position. Now we start with 2nd position of list. 2nd element of the list will be compared with all other elements except 1st element. The 2nd smallest element of the list will be replaced with 2nd element of array.
In 2nd iteration, 18 is 2nd smallest element in the list so that will be swap with 2nd element of list. now the list is given as after
list = {10, 18, 24, 75, 70, 20, 60, 35}