All mock tests are FREE till 31 December — register to save your progress
Unit 4 · Data Structures HTET 2022 PGT Computer Science

Which of the following recurrence relation is related to worst case time complexity of quick sort ?

निम्न में से कौन-सा रिकरेंस रिलेशन क्विक सॉर्ट एल्गोरिथ्म की वर्स्ट केस टाइम कॉम्प्लेक्सिटी से संबंधित है ?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. T(n) = T(n−1) + Cn

Explanation

In the worst case the pivot splits n elements into 0 and n − 1, so T(n) = T(n − 1) + cn = O(n²).

वर्स्ट केस में पिवट n तत्वों को 0 और n − 1 में बाँटता है, अतः T(n) = T(n − 1) + cn = O(n²)।

More Data Structures questions