CUET PG 2025 — Computer PYQ
CUET PG | Computer | 2025The Quicksort and randomized Quicksort procedures differ in:
Choose the correct answer:
- A.
Selection of Pivot element
(Correct Answer) - B.
Worst case time complexity
- C.
Best case time Complexity
- D.
Final Output
Selection of Pivot element
Explanation
Pivot Selection Ka Antar
-
Standard Quicksort: Isme pivot fixed hota hai (pehle se tay).
Pivot=A[low]yaA[high] -
Randomized Quicksort: Isme pivot ko array ke range [i…j] mein se randomly uthaya jata hai.
Pivot=A[random(i,j)]
Iska Impact (Complexity)
Jab hum random pivot chunte hain, toh hum Worst Case hone ki probability ko minimize kar dete hain.
-
Worst Case (Standard): Agar input pehle se sorted ho, toh complexity O(n2) ho jati hai:
T(n)=T(n−1)+Θ(n) -
Expected Case (Randomized): Randomization se humein hamesha balanced partition milne ki umeed rehti hai, jisse average time complexity fix ho jati hai:
E[T(n)]=O(nlogn)
Summary: Donon procedures ke kaam karne ka tarika (Logic) ek hi hai, lekin "Pivot Element ka chunav" hi wo point hai jahan dono alag ho jate hain.

