Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Which of the following is true regarding mergesort? a. It is difficult to cod

ID: 3741860 • Letter: 1

Question

1. Which of the following is true regarding mergesort?

a. It is difficult to code without recursion.

b. It is difficult to code to ensure stability.

c. It may be coded to operate in a bottom-up fashion.

d. The input must be processed to exploit ordered subarrays or sublists in the input.

2. What happens in the third phase of the Counting sort?

a. Add to appropriate Counter for each key.

b. Clear Count Table.

c. Copy each record to output.

d. Determine first slot for each range value.

3. Which of the following sorts does not straight forward statement?

a. Insertion sort. b. Mergesort. c. Quicksort. d. Selection sort

4. Which situation for operation on a maxheap uses a swim?

a. decrease key b. getmax. c. Insertion sort. d. Heapsort

5. Which of the following sort is not based on key comparisons?

a. Insertion sort. d. LSD Radix sort. c. Mergesort. d. Quicksort

6. Which sort may be viewed as being an imrpovement on insertion sort?

a. Counting sort b. Heapsort. c. Quicksort. d. Shell sort

7. Counting sort is often used as a part of which sorting algorithm?

a. Insertion sort. b. LSD Radix sort. c. Mergesort. e. Quicksort

8. Which sort never compares twoinputs (to each other) twice?

a. Heapsort. b. Mergesort. c. Quicksort. d. Shell sort

Explanation / Answer

1. (b) It is difficult to code to ensure stability: The merge sort is stable sorting technique and therefore it can be easily coded to ensure stability

2. (c) Copy each record to output: In third phase of the counting sort each object from the input sequence is given in the output and their index is decremented by 1.

3. (b) Merge sort: Insertion sort, quicksort and slection sort are applied on a single list of element, whereas merge sort need to be divided into various sublists

4. (c) Insertion sort: When ever we are inserting an element int he heap, then it has to be managed by higher order item swimming up and the lower order item sinking down.

5. (b) LSD redix sort: It is a non-comparative sorting algorithm for sorting the data. It sort the data by grouping keys by the individual digit which have the same value and relatively same position.

6. (d) Shell sort: Shell sort takes the far apart element pair and sort it first and then keep on reducing the gap between the element being compared and the current position element

7. (b) LSD Radix sort: counting sort is used as a subroutine in the LSD Radix sort

8. (a) Heapsort: In heap sort, the input is divided into two part sorted and unsorted region, and then take the largest element from unsorted region and move it sorted region.