Nothing special here. It’s just a blog post for summarising my algorithm learning course. Although this was already taught in the University, I remember nothing about it because I haven’t touched it for the long time.
- Shuffle the array.
- Select one item, can be the first item or last item as the pivot (the partitioned item).
- Partition the array into 2 parts, so that
- The pivot entry is in the right place
- No larger entry to the left of the pivot item
- No smaller entry to the right of pivot item
- Sort each piece recursively.