quick sort/find first N/rearrange array