+1 vote
in Data Structures & Algorithms II by (110k points)
Statement 1: Shell sort is a stable sorting algorithm.

Statement 2: Shell sort is an in-place sorting algorithm.

(a) Both statements are true

(b) Statement 2 is true but statement 1 is false

(c) Statement 2 is false but statement 1 is true

(d) Both statements are false

The question was posed to me in unit test.

This is a very interesting question from Shell sort in portion Sorting of Data Structures & Algorithms II

1 Answer

+1 vote
by (614k points)
selected by
 
Best answer
The correct option is (b) Statement 2 is true but statement 1 is false

The best explanation: In Shell sort, the relative order of elements with equal values may change. Therefore, it is not a stable sorting algorithm. Shell sort is an in-place sorting algorithm as it requires O(1) auxiliary space.

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

...