You are not logged in. Please login at www.codechef.com to post your questions!

×

# GEEK01 - Editorial

Practice

Contest

Author: Bhuvnesh Jain

Tester: Bhuvnesh Jain

Editorialist: Bhuvnesh Jain

CAKEWALK

# Prerequisites

Sorting, Looping Techniques

# Problem

The median of a matrix is defined as the median of the median of all rows. Find the median of the matrix.

# Explanation

To find the median, we need the numbers to be sorted in increasing order. To sort the numbers, we can use merge sort or inbuilt sort algorithm available in the languages. Once, we find the median of all rows, we can do the same trick to find the median of all rows.

To read more about sorting algorithms, refer to this link

# Time Complexity

$O(N * N * \log{N})$, per test case.

# Space Complexity

$O(N * N)$

Setter's solution

asked 20 Nov '17, 22:01

6★likecs
3.7k2380
accept rate: 9%

19.8k350498541

 toggle preview community wiki:
Preview

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×15,683
×1,652
×790
×593
×4

question asked: 20 Nov '17, 22:01

question was seen: 301 times

last updated: 26 Nov '17, 16:35