Quicksort algorithm
Apr 9, 2021
I learned the quicksort algorithm in a course called Data Structure and Algorithm during my study at university. It is fun to know a bunch of algorithms actually solve the problems but the learning experience is such a pain at that time.
Fortunately, I got a good grade in the course without sleeping. Two years after, I recognize it is important to keep my knowledge fresh and decide to write this blog. I hope it can also help other learners as well.
QuickSort Time Complexity:
- Average case: O(n log n)
- Best case: O(n log n)
- Worst case: O(n²)
Note: There are other options to chose pivot. The example in this blog uses the last item as the pivot.
Recourses:
Python implementation: