Consider quick sort with tail-call optimization: always recurse on the smaller partition first and use iteration for the larger partition. What is the worst-case space complexity of this optimized quick sort?
GATE CSE · Algorithms
Master topic for Sorting. Includes Merge Sort, Quick Sort, Heap and Heap Sort.
187 questions · 0 PYQs · 20 AI practice · GATE CSE 2027
Consider quick sort with tail-call optimization: always recurse on the smaller partition first and use iteration for the larger partition. What is the worst-case space complexity of this optimized quick sort?
Quadratic probing uses the probe sequence h(k, i) = (h'(k) + c₁i + c₂i²) mod m. Which of the following is a known limitation of quadratic probing compared to double hashing?
Heap sort on an array of elements performs which of the following sequence of steps?
Consider a hash table with m = 7 slots using the division method h(k) = k mod 7. Keys 50, 700, 76, 85, 92, 73, 101 are inserted using linear probing. What is the position of key 101 after all insertions?
Which of the following inputs would cause the worst-case behaviour in quick sort with the median-of-three pivot strategy?
In double hashing, the probe sequence is h(k, i) = (h₁(k) + i × h₂(k)) mod m. What condition must h₂(k) satisfy for double hashing to probe all m slots?
What is the total number of comparisons performed during on an array of elements in the worst case?
What is the primary advantage of Merge Sort over Bubble Sort?
For a hash table using chaining with a good hash function and load factor α = n/m, the expected time complexity for insert, search, and delete operations is:
Which of the following statements about the stability of Merge Sort is TRUE?
The total number of comparisons performed by merge sort to sort an array of elements in the worst case is:
The total number of comparisons performed by merge sort to sort an array of distinct elements in the worst case is:
Which of the following statements about a heap of elements are TRUE?
A merge sort implementation uses an optimization: if , skip the merge step (the two halves are already in order). On an already-sorted array of elements, what is the time complexity of this optimized merge sort?
Consider a hash table of size m = 7 with keys inserted using h(k) = k mod 7. Keys 22, 30, 11, 4 are already in the table. Key 25 is to be inserted. Using quadratic probing with h(k,i) = (h(k) + i²) mod 7, at which slot is 25 inserted?
Consider the merge step of merge sort. Two sorted subarrays and are merged. How many comparisons are performed in the worst case?
In hashing, what happens when two keys map to the same location?
An array of elements is already sorted in ascending order. What is the time complexity of quick sort on this input when the first element is always chosen as pivot?
What is the load factor of a hash table with 1000 slots and 500 elements?
The total number of comparisons made by quick sort using the Lomuto partition on the array with the last element as pivot is:
Want unlimited AI-generated Sorting questions?
Sign up free and practice with adaptive difficulty — Easy, Medium, Hard. New questions every session.
Start practising for free →