more of an algorithm question than a C question
How would you, if it's indeed possible, find the exact median of an unordered list, on the fly?
For example, how would you find the median of the following list (which is 5) without sorting the list and keeping it in memory:
5, 7, 4, 11, 1, 3, 8, 2, 12
Appreciate the responses but
For "unregistered":
You were "assuming the list is in an array", which I had said cannot be in memory. The numbers are spit out on the fly, you read them once individually and then they are gone.
For "Prelude" :
"search for the next highest number in the list until you reach the very middle number"
Again, there's nothing to search. Perhaps my wording was bad.
I am working with very large loop generated numbers. Once the loop iterates, the value is lost. It's not practical or efficent to store all of them (multi millions) . I was, however, able to devise something by recognizing range values. Again, I appreciate the time you both have taken in considering a solution.
Dave