3 ms·
That's a bullshit question. My own response would have been a variant on radix-sort. Keep an array of 256 counters, and make a pass counting all of the high b
by ted_dunning 2y ago
That's a bullshit question.
My own response would have been a variant on radix-sort. Keep an array of 256 counters, and make a pass counting all of the high bytes. Now you know the high byte of the median. Make another pass keeping a histogram of the second byte of all values that match the high byte. And so on.
This takes four passes and requires 256 x 8 byte counters plus incidentals.
In a single pass you can't get the exact answer.