java program to find median of n numbers without using array asked 10 Aug, 11:19

If languagespecific libraries are not intended then: If the numbers are already sorted as they arrive then a LinkedList and using the two pointers approach would find the median, else a balanced binary search tree could be built to find the median. answered 10 Aug, 16:00

In principle, if you are handling values one by one, you will need to retain at least the first half of the values (if you know the eventual count of values) to ensure that you do not discard the median. By contrast you can calculate the mean of a stream of values continuously. without retaining any data value after updating the mean. answered 10 Aug, 18:26
