Question 18Asked in Bihar STET Paper 2 Computer Science (Class 11-12), 12 Sep 2023, Shift 2

What is the time complexity of the Divide and Conquer algorithm for finding the maximum and minimum elements in an array of size "n"?

  1. AO(n)
  2. BO(log n)
  3. CO(n log n)
  4. DO(n^2)
Show answerHide answer

Correct answer: (A) O(n)

Explanation

The divide-and-conquer MaxMin algorithm makes about 3n/2 - 2 comparisons; T(n) = 2T(n/2) + 2 solves to O(n).

From Bihar STET Paper 2 Computer Science (Class 11-12) PYQ, 12 Sep 2023, Shift 2

This is question 18 of Bihar STET Paper 2 Computer Science (Class 11-12) PYQ, 12 Sep 2023, Shift 2. 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.