Home › Previous year questions › GATE 2019 CS › Question 30GATE 2019 CS – Question 30 Algorithms · Searching, Sorting and Hashing · 1 mark · Numerical answer
An array of 25 distinct elements is to be sorted using quicksort. Assume that the pivot element is chosen uniformly at random. The probability that the pivot element gets placed in the worst possible location in the first round of partitioning (rounded off to 2 decimal places) is ________.
Practise this question in The GATE Grind →
Show answer and explanation Correct answer: 0.07 to 0.09
Explanation The worst locations are the two ends (the pivot is the smallest or the largest element), so the probability is $\frac{2}{25}=0.08$.
More Searching, Sorting and Hashing questions GATE 2019 CS Q50 – Consider the following statements: I. The smallest element in a max-heap is always at a… GATE 2015 CS (CS1) Q14 – Which one of the following is the recurrence equation for the worst case time complexity… GATE 2016 CS (CS1) Q23 – The worst case running times of Insertion sort, Merge sort and Quick sort, respectively,… GATE 2017 CS (CS1) Q58 – Let A be an array of 31 numbers consisting of a sequence of 0's followed by a sequence of… GATE 2014 CS (CS1) Q24 – Quicksort P sorts ascending using the first element as pivot. Let t₁ and t₂ count its… GATE 2014 CS (CS1) Q49 – Find the minimum comparisons needed to find both minimum and maximum of 100 numbers. All Searching, Sorting and Hashing questions →