the optimize version of the quickSort algorithm