Question:
What is the worst-case time complexity of the Quick Sort algorithm?
क्विक सॉर्ट (Quick Sort) एल्गोरिदम की सबसे खराब स्थिति (Worst-case) समय जटिलता क्या है?
Options:
- \(O(n^2)\)
- \(O(n \log n)\)
- \(O(n)\)
- \(O(\log n)\)
- \(O(n^2)\)
- \(O(n \log n)\)
- \(O(n)\)
- \(O(\log n)\)
Correct Answer: a)
Explanation:
When the chosen pivot is repeatedly the smallest or greatest element (such as when partitioning an already sorted array with the first/last element as pivot), Quick Sort degenerates to **\(O(n^2)\)** (Option a).
जब चुना गया पिवट सबसे छोटा या सबसे बड़ा अवयव हो, तो क्विक सॉर्ट का समय **\(O(n^2)\)** हो जाता है (विकल्प a)।