pivot
less
greater
empty
empty
empty
cherries
kiwi
grapes
avocado
pineapple
peach

Place the elements of a list
in alphabetical order

shuffle
start

Sorted by name – phew!

rewind & scroll for close examination

0. function quicksort(list) {
1. if (list.length < 2) {
2. return list;
3. }
4.
5. const pivot = random(list);
6. const less = list.filter(i => i < pivot);
7. const greater = list.filter(i => i > pivot);
8.
9. return [
10. ...quicksort(less),
11. pivot,
12. ...quicksort(greater)
13. ];
14. }