another version of quick sort