GATE | GATE CS 2019 | Question 46
There are n unsorted arrays: A1, A2, ….,An. Assume that n is odd. Each of A1, A2, …., An contains n distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of A1, A2, ….,An is ________ .
(A) Ο(n log n)
(B) Ο(n2)
(C) Ο(n)
(D) Ω(n2log n)
Answer: (B)
Explanation: Since given arrays are not sorted, so the time complexity to find median is O(n) in an unsorted array. You need to apply this apgorithm n time to find all medians and again once to find median of all these medians, so total time complexity is,
= O(n)*O(n) + O(n) = O(n2) + O(n) ≈ O(n2)
So, option (B) is correct.
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 1999 | Question 36
- GATE | GATE CS Mock 2018 | Question 39
- Top 5 Topics for Each Section of GATE CS Syllabus
- How to prepare in Last 10 days to score high in GATE?
- Aptitude | GATE IT 2006 | Question 7
- Aptitude | GATE IT 2006 | Question 8
- GATE | GATE CS 2013 | Question 1
- GATE | GATE CS 2013 | Question 3
- GATE | GATE CS 2013 | Question 4
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 6
- GATE | GATE CS 2013 | Question 7
- GATE | GATE CS 2013 | Question 8
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 65



