1.

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) 0The question was asked during an interview for a job.My doubt is from Sorting topic in section Sorting of Data Structures & Algorithms II

Answer»

Right option is (d) 0

Best 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.



Discussion

No Comment Found

Related InterviewSolutions