Let’s Sort It Out, The Quicksort Way

Let’s Sort It Out, The Quicksort Way

6 years ago
Anonymous $dicfOfy7s2

https://medium.com/@ayoshing/lets-sort-it-out-the-quicksort-way-9292e67cfc5e

There comes a time in life when you need to sort things out, because life is sort of a big mess. There’s just something admirable about a sorted array — it’s orderly, predictable, and easy to work with. In this post, I’ll be walking through the Quicksort algorithm and implementing it using JavaScript. I’m super excited about this topic and hope I don’t miss anything. So, let’s get started!

Quicksort is a divide and conquer algorithm–basically, we divide the array into sub-arrays, then execute some action to those sub-arrays. It is also a comparison algorithm, in that it is swap-based. Lastly, keep in mind that it is not a stable sort, meaning it will reorder elements with identical keys.