35.6k views
0 votes
Suppose that list is sorted using the selection sort algorithm as discussed in the book. What is the resulting list after two passes of the sorting phase; that is, after two iterations of the outer for loop?

a. list = {10, 18, 24, 20, 75, 70, 60, 35}
b. list = {10, 18, 20, 24, 75, 70, 60, 35}
c. list = {10, 18, 24, 75, 70, 20, 60, 35}
d. list = {10, 20, 24, 75, 70, 20, 60, 35}

User ClarkXP
by
4.4k points

1 Answer

3 votes

Answer:

The answer is "Option C".

Explanation:

In the given question the main list is missing. so, first, we defined the main list after that explain the answer to this question:

The main list:

list={24, 20, 10, 75, 70, 18, 60, 35}

In the above-given choices, option c is correct because in the list, the element 10 and element 18 are fixed in its correct position and element 10 and 24 are positioned in the placed of 18 elements, and the 20 elements will be placed as follows, and the other choices were wrong because in this data is in its wrong place.

User Pcoving
by
4.8k points