Find median of numbers held in servers

Given N computers networked together, with each computer storing N integers, describe a procedure for finding the median of all of the numbers. Assume that a computer can only hold O(N) integers (i.e. no computer can store all N2 integers). Also assume that there exists a computer on the network without integers, that we can use to interface with the computers storing the integers.

Probable Answer:



Median = Sum / Count
Find the sum, count requires O(1) memory,
[1 2 3] [4 5 6] [7 8 9]
| | |
[2] [5] [9] (The machine with free memory)
| | |
^^^^^^^^^^^^^^^^^
[5]

No comments: