Redo the strings sorting function, allocate/free memory as needed.
This is the normal implementation of quicksort.