What is the minimum number of passes in which the list can be sorted in ascending order?
a. 4
b. 6
c. 3
d. 5?
Answers
Answered by
0
hєч plєαѕє mαrk вrαín.....
The selection sort improves on the bubble sort by making only one exchange for every pass through the list. In order to do this, a selection sort looks for the largest value as it makes a pass and, after completing the pass, places it in the proper location. As with a bubble sort, after the first pass, the largest item is in the correct place. After the second pass, the next largest is in place. This process continues and requires n−1n−1passes to sort n items, since the final item must be in place after the (n−1)(n−1) st pass.
Figure 3 shows the entire sorting process. On each pass, the largest remaining item is selected and then placed in its proper location. The first pass places 93, the second pass places 77, the third places 55, and so on. The function is shown in ActiveCode 1.
The selection sort improves on the bubble sort by making only one exchange for every pass through the list. In order to do this, a selection sort looks for the largest value as it makes a pass and, after completing the pass, places it in the proper location. As with a bubble sort, after the first pass, the largest item is in the correct place. After the second pass, the next largest is in place. This process continues and requires n−1n−1passes to sort n items, since the final item must be in place after the (n−1)(n−1) st pass.
Figure 3 shows the entire sorting process. On each pass, the largest remaining item is selected and then placed in its proper location. The first pass places 93, the second pass places 77, the third places 55, and so on. The function is shown in ActiveCode 1.
Attachments:
Similar questions
English,
7 months ago
Environmental Sciences,
7 months ago
Science,
7 months ago
Political Science,
1 year ago
Geography,
1 year ago
Math,
1 year ago