If you have one huge amount of numbers and one hundred computers, How would you find the median of the numbers?
相关问题
- Finding k smallest elements in a min heap - worst-
- binary search tree path list
- High cost encryption but less cost decryption
- multidplyr : assign functions to cluster
- How to get a fixed number of evenly spaced points
相关文章
- What are the problems associated to Best First Sea
- How to use doMC under Windows or alternative paral
- Coin change DP solution to keep track of coins
- Algorithm for partially filling a polygonal mesh
- Robust polygon normal calculation
- Algorithm for maximizing coverage of rectangular a
- Parallel while loop in R
- Does gfortran take advantage of DO CONCURRENT?
Use selection algorithm.
this solution has an avg runtime of O(n) in order to make it asymptotic runtime of O(n), each processor should split the numbers to groups of 5 elements find the median of each group (using insertion sort) and send those medians back to the leader, the leader will choose the median of those medians (using the same algo) and that will be the pivot
read the wiki article - http://en.wikipedia.org/wiki/Selection_algorithm