In how many comparisons does the array arr={1,4,2,3,5} gets sorted if we use sleep sort?

Giang Phạm

New member
In how many comparisons does the array arr={1,4,2,3,5} gets sorted if we use sleep sort?
A. 5
B. 3
C. 1
D. 0
 
Answer: d
Explanation: Sleep sort makes different elements of the array to sleep for an amount of time that is proportional to its magnitude. So it does not require to perform any comparison in order to sort the array.
 

Tìm kiếm

Back
Top