Question 17Asked in Bihar STET 2024 Paper II Computer Science, 11 Jun 2024, Shift 2 (3:00 PM)

Merge Sort is an example of a sorting algorithm that uses the Divide and Conquer paradigm. What is its time complexity in the worst-case scenario?मर्ज सॉर्ट एक छँटाई एल्गोरिथ्म का एक उदाहरण है जो विभाजन और विजय प्रतिमान का उपयोग करता है। सबसे खराब स्थिति में इसकी समय जटिलता क्या है?

मर्ज सॉर्ट एक छँटाई एल्गोरिथ्म का एक उदाहरण है जो विभाजन और विजय प्रतिमान का उपयोग करता है। सबसे खराब स्थिति में इसकी समय जटिलता क्या है?
  1. AO(n)ओ (एन)
  2. BO(n log n)ओ (एन लॉग एन)
  3. CO(n^2)ओ (एन^2)
  4. DO(log n)ओ (लॉग एन)
Show answerHide answer

Correct answer: (B) O(n log n)ओ (एन लॉग एन)

Explanation

Merge sort always splits the array in half and merges in linear time: T(n) = 2T(n/2) + n = O(n log n) in the best, average and worst case.Merge sort हमेशा array को आधा बाँटता है और रैखिक समय में merge करता है: T(n) = 2T(n/2) + n = O(n log n), सर्वोत्तम, औसत और सबसे खराब, तीनों स्थितियों में।

From Bihar STET 2024 Paper II Computer Science PYQ, 11 Jun 2024, Shift 2 (3:00 PM)

This is question 17 of Bihar STET 2024 Paper II Computer Science PYQ, 11 Jun 2024, Shift 2 (3:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.