cloned quicksort function for arrays of lists, for wiki sort