Unit 6: Efficient Sorting Algorithms & Analysis - Subjective Questions

CSE330 — Competitive Coding Approaches-Techniques • Practice Questions with Detailed Answers

20 questions

1

What are sorting algorithms? Explain why this time complexity is significant for comparison-based sorting.

2

Derive the time complexity of merge sort using a recurrence relation.

3

Describe the recursive merge sort algorithm and illustrate it using the array .

4

Explain iterative merge sort. How does it differ from recursive merge sort?

5

Write the main steps of the merge operation used in merge sort and explain why it takes linear time.

6

Explain the quick sort algorithm and demonstrate its partitioning process on using as the pivot.

7

Compare the Lomuto and Hoare partition schemes used in quick sort.

8

Derive the best-case and worst-case time complexities of quick sort. How can the worst case be reduced in practice?

9

Distinguish between merge sort and quick sort with respect to complexity, memory, stability, and practical use.

10

How can an array be sorted according to the frequency of its elements? Explain an efficient approach.

11

Sort in decreasing order of frequency. For equal frequencies, place the smaller value first.

12

Explain how to find the minimum-length sub-array which, if sorted, makes the entire array sorted.

13

Find the minimum sub-array that must be sorted in so that the entire array becomes sorted.

14

What special cases must be considered when finding the minimum sub-array that needs sorting?

15

Explain lexicographic sorting of strings. How are two strings compared when one is a prefix of the other?

16

Describe different criteria that may be used to sort a collection of strings.

17

What is case-specific sorting of strings? Explain how to sort letters while preserving the original uppercase and lowercase positions.

18

How can strings be sorted case-insensitively while producing deterministic results for strings that differ only by case?

19

Explain an efficient method to count distinct pairs in an array whose absolute difference is .

20

Count the distinct pairs with difference in . Explain how duplicates are handled.