updated quicksort3.  It now works properly for all test cases