You are not logged in. Please login at to post your questions!


median of n numbers without using array

java program to find median of n numbers without using array

asked 10 Aug, 11:19

h7214's gravatar image

accept rate: 0%

If language-specific 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

utkalsinha's gravatar image

accept rate: 13%

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

joffan's gravatar image

accept rate: 12%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 10 Aug, 11:19

question was seen: 332 times

last updated: 10 Aug, 16:00