and can not find a solution.
We have an unordered array of uniqe integers.
We need to split this array into 2 equal piles, and all items in first pile should be lesser than all in second (not sum, every single one).
Hard part here is to do this with just one loop trough array.
So it not just O(n), but just to go trough every element once.
So you can not find "median" and then split it
it should be somehow in real-time or so
I was think about take parts from quick sort or so, but they're not reliable enough
Any ideas?
What language?
I don't think it's possible without finding the median
where can I get some test data for that
Обсуждают сегодня