Is it possible to split a sequence of numbers into two groups based in median value without sorting?

Posted by Everaldo Aguiar on Stack Overflow See other posts from Stack Overflow or by Everaldo Aguiar
Published on 2010-06-17T19:17:34Z Indexed on 2010/06/17 19:23 UTC
Read the original article Hit count: 377

Is there an algorithm to split a sequence of random numbers into two groups based on a median value determined on the fly(without sorting them)?

Ex. If I have the sequence 2-3-6-7-1-4-5, the result would be two separated groups:

A) 1 2 3

B) 5 6 7

Median value: 4

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about sorting