Pick a "judge" value. Everyone smaller goes left, everyone larger goes right.
The pivot element (last element = 1) divides the array into "smaller than pivot" and "larger than pivot".
> arr: [3,6,8,10,1,2,1] > pivot = arr[6] = 1 > i = -1
Pick a "judge" value. Everyone smaller goes left, everyone larger goes right.
The pivot element (last element = 1) divides the array into "smaller than pivot" and "larger than pivot".
> arr: [3,6,8,10,1,2,1] > pivot = arr[6] = 1 > i = -1
Sign in to cast your vote
Sign in to share your feedback and join the discussion.