# median of medians question

• May 17th 2011, 05:53 AM
Narek
median of medians question
Hello folks.

Lets say we have two sets A and B with many elements.
I sorted them and I calculated their medians.

Now I need AUB median.
As far as I see the median of AUB is not equal to (A's median + B's median)/2 right?

So how am I supposed to calculate AUB median the fastest way?

Thank you in advance for your time and your help (Happy)
• May 17th 2011, 06:24 AM
CaptainBlack
Quote:

Originally Posted by Narek
Hello folks.

Lets say we have two sets A and B with many elements.
I sorted them and I calculated their medians.

Now I need AUB median.
As far as I see the median of AUB is not equal to (A's median + B's median)/2 right?

So how am I supposed to calculate AUB median the fastest way?

Thank you in advance for your time and your help (Happy)

Merge A and B preserving the sort, then find the median of the merged sorted list.

CB
• May 17th 2011, 01:51 PM
Narek
CaptainBlack,

Thanks for the reply.

Actually, I already knew what you said. The problem is that I want to ONLY use the 2 medians to calculate the new median.
Well, to be more clear, this is a logic used in a programming code. I don't intend to get back to A and B to get their values and then merge them and then recalculate a new median. That will slow down the program because I have a large tree. I want to get the median instantly using A and B medians.
Seems impossible right?

Thanks again for the help.
• May 17th 2011, 02:16 PM
CaptainBlack
Quote:

Originally Posted by Narek
CaptainBlack,

Thanks for the reply.

Actually, I already knew what you said. The problem is that I want to ONLY use the 2 medians to calculate the new median.
Well, to be more clear, this is a logic used in a programming code. I don't intend to get back to A and B to get their values and then merge them and then recalculate a new median. That will slow down the program because I have a large tree. I want to get the median instantly using A and B medians.
Seems impossible right?

Thanks again for the help.

It is provably impossible.

CB