Approach (Based upon quick sort):
- Designate one computer as the master and others as slave.
- Let the Master choose one random number, say X from its array of numbers and ask all the other slave nodes to partition their arrays based on Pivot X.
- Then Slave nodes report back the count of numbers less than X and count of numbers more than X (can be done in parallel).
- The Master node then add all the numbers received less than X and more than X and checks if the median is less than or greater than X.
- Now choose X2 based upon the partition data depending upon where the median might be ie in the left partition or the right partition.
- Continue till we get median.
Can you please post step by step example.
ReplyDeleteConfuse.