1.

Cocktail sort uses which of the following methods for sorting the input?(a) selection(b) partitioning(c) merging(d) exchangingI got this question at a job interview.My question is taken from Sorting topic in section Sorting of Data Structures & Algorithms II

Answer» CORRECT answer is (d) exchanging

To explain: Cocktail sort USES a method of exchanging as it swaps the elements which are out of order. This SWAPPING is done in two phases i.e. FORWARD phase and BACKWARD phase.


Discussion

No Comment Found

Related InterviewSolutions