This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Shell Sort – 1”.

1. What is the other name for a shell sort algorithm?

a) Diminishing increment sort

b) Diminishing decrement sort

c) Insertion sort

d) Selection sort

View Answer

Explanation: The other name for a shell sort algorithm is diminishing decrement sort as the distance between comparisons decreases as the algorithm runs until the last phase.

2. The worst case running time of shell sort, using Shell’s increments is?

a) O(N)

b) O(N log N)

c) O(log N)

d) O(N^{2})

View Answer

Explanation: The lower bound of a shell sort algorithm is mathematically found to be O(N

^{2}).

3. Who invented the shell sort algorithm?

a) John Von Neumann

b) Donald Shell

c) Tony Hoare

d) Alan Shell

View Answer

Explanation: Shell sort algorithm is invented by Donald shell. Merge sort is invented by John Von Neumann. Quick sort is invented by Tony Hoare.

4. Shell sort algorithm is the first algorithm to break the quadratic time barrier.

a) True

b) False

View Answer

Explanation: Shell sort broke the quadratic time barrier as it works by comparing elements that are distant.

5. Shell sort algorithm is an example of?

a) External sorting

b) Internal sorting

c) In-place sorting

d) Bottom-up sorting

View Answer

Explanation: Shell sort is an example of internal sorting because sorting of elements is done internally using an array.

6. Shell sort uses a sequence called a incrementing sequence to sort the elements.

a) True

b) False

View Answer

Explanation: Shell sort uses an increment sequence h1, h2, h3… and this sequence will work as long as h1=1.

7. Which of the following sorting algorithms is closely related to shell sort?

a) Selection sort

b) Merge sort

c) Insertion sort

d) Bucket sort

View Answer

Explanation: Shell sort performs an insertion sort on hk independent arrays. It is mainly a variation of insertion sort.

8. Why is Shell sort called as a generalization of Insertion sort?

a) Shell sort allows an exchange of far items whereas insertion sort moves elements by one position

b) Improved lower bound analysis

c) Insertion is more efficient than any other algorithms

d) Shell sort performs internal sorting

View Answer

Explanation: Shell sort is an extension of insertion sort because it swaps elements at far distances and at a faster rate.

9. Given an array of the following elements 81,94,11,96,12,35,17,95,28,58,41,75,15.

What will be the sorted order after 5-sort?

a) 11,12,15,17,28,35,41,58,75,81,94,95,96

b) 28,12,11,35,41,58,17,94,75,81,96,95,15

c) 35,17,11,28,12,41,75,15,96,58,81,94,95

d) 12,11,15,17,81,94,85,96,28,35,41,58,75

View Answer

Explanation: The general strategy to hk sort is for each position, i, in hk,, hk+1,…., N-1, place the element in the correct spot among i, i-hk,i-2hk, etc.

10. Which of the following statements is the basic for loop for a shell sort algorithm?

a) for(increment=N/2;increment>0;increment/=2)

b) for(i=1;i<n;i++)

c) for(i=n/2;i>=0;i–)

d) for(i=0;i< n;i++;numelements–)

View Answer

Explanation: The given for loops belong to Shell sort, insertion sort, heap sort, merge sort respectively.

11. On how many increment sequences does the worst case analysis of shell sort depends?

a) one

b) two

c) three

d) four

View Answer

Explanation: The worst case analysis of shell sort depends on two increment sequences- using Shell’s increments, Sedgewick’s and Hibbard’s increments.

12. What is the worst case running time of shell sort using Hibbard’s increments?

a) O(N)

b) O(N^{2})

c) O(N^{1/2})

d) O(N^{3/2})

View Answer

Explanation: Mathematically, the lower bound analysis for shell sort using Hibbard’s increments is O(N

^{3/2}).

13. What is the general form of Shell’s increments?

a) 1,2,3,…,n

b) 1,3,7,….,2k-1

c) 1,3,5,7,….,k-1

d) 1,5,10,15,…, k-1

View Answer

Explanation: Shell’s increments are of the form 1,3,7,….,2k-1. The key difference is that the consecutive elements have no common factors.

14. What is the worst case analysis of shell sort using Shell’s increments?

a) O(N)

b) O(N^{2})

c) O(N^{1/2})

d) O(N^{3/2})

View Answer

Explanation: The worst case analysis is mathematically found to be O(N

^{2}). The proof is rather complicated.

15. What is the worst case analysis of Shell sort using Sedgewick’s increments?

a) O(N^{2})

b) O(N^{3/2})

c) O(N^{4/3})

d) O(N^{5/4})

View Answer

Explanation: The worst case analysis of Shell sort using Sedgewick’s increments is mathematically calculated to be O(N

^{4/3}).

**Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.**

To practice all areas of Data Structures & Algorithms, __here is complete set of 1000+ Multiple Choice Questions and Answers__.