+1 vote
in Data Structures & Algorithms II by (110k points)
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 39

This 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

1 Answer

+1 vote
by (614k points)
selected by
 
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...