you don't need extra arrays for qsort. 
you can do all sorting in-place.