1.

Shell sort is applied on the elements 27 59 49 37 15 90 81 39 and the chosen decreasing sequence of increments is (5,3,1). The result after the first iteration will be(a) 27 59 49 37 15 90 81 39(b) 27 59 37 49 15 90 81 39(c) 27 59 39 37 15 90 81 49(d) 15 59 49 37 27 90 81 39This question was posed to me during a job interview.The origin of the question is Shell sort in portion Sorting of Data Structures & Algorithms II

Answer»

Right ANSWER is (c) 27 59 39 37 15 90 81 49

Easiest EXPLANATION - GIVEN elements 27 59 49 37 15 90 81 39,

First Iteration (span = 5):

So, the SEQUENCE after first iteration will be, 27 59 39 37 15 90 81 49.



Discussion

No Comment Found

Related InterviewSolutions