A
A
Alexeytur2018-12-24 16:51:59
Algorithms
Alexeytur, 2018-12-24 16:51:59

Is it possible to calculate the median of the sample incrementally?

Good afternoon.
There is a program that receives random numbers over the network and calculates statistics on them. The program must be able to run for a long time. The problem with calculating the median - according to the definition, you need to sort the selection and take the value in the middle of the array. That is, you need to store all the received values. But with large amounts of incoming data / long running time, the memory will run out and the program will crash. Is there a way out?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmshar, 2018-12-24
@Alexeytur

There is, and it's called Streaming Median:
https://programmingpraxis.com/2012/05/29/streaming...
https://habr.com/post/264987/
https://www.cse.wustl.edu/ ~jain/papers/ftp/psqr.pdf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question