There are unsorted arrays: . Assume that is odd.Each of contains distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of is
View worked solution
Answer: C
To find the median of the medians of unsorted arrays , each containing distinct elements, we can break the process down into two main steps:
-
Find the median of each individual array:
Each array is unsorted and has elements. The median of an unsorted array of size can be found in worst-case time using a linear-time selection algorithm (such as the Median of Medians algorithm).
Since there are such arrays, the total time required to find the medians of all arrays is:
-
Find the median of the computed medians:
Let the medians of the arrays be . This is a set of elements. Finding the median of these elements takes:
Total Worst-Case Time Complexity:
Combining both steps, the overall worst-case time complexity is:
Hence, the correct option is C.
Free practice · Your answers on this page are not saved.
