partial sort
Bit hacks