Quicksort algorithm based on Wikipedia pseudocode