1.

An array that is first 7-sorted, then 5-sorted becomes _________(a) 7-ordered(b) 5-ordered(c) both 2-ordered and 5-ordered(d) both 7-ordered and 5-orderedThis question was addressed to me in an online quiz.My question is from Shell sort in division Sorting of Data Structures & Algorithms II

Answer»

The correct OPTION is (d) both 7-ordered and 5-ordered

The BEST explanation: An array that is 7-sorted, BECOMES 7-ordered. And an array that is 5-sorted, becomes 5-ordered. If k-ordered array is h-sorted, it REMAINS k-ordered. THUS, an array that is first 7-sorted, then 5-sorted becomes both 7-ordered and 5-ordered.



Discussion

No Comment Found

Related InterviewSolutions