COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
For this array of numbers:[1, 2, 3, 4, 5]How many comparisons are made using Selection Sort?
|
5
|
|
10
|
|
1
|
|
6
|
|
11
|
Explanation:
Detailed explanation-1: -10 should be the correct answer.
Detailed explanation-2: -For 10 data items, this is 45 comparisons.
Detailed explanation-3: -In general, the average number of comparisons per pass in selection sort will always be one half of the number of items to be sorted. For eight items, we have 1/2(82 + 8) = 1/2(64 + 8) = 1/2(72) = 36 comparisons.
There is 1 question to complete.