21

Quicksort

When it comes to sorting stuff, one of the most popular algorithms we have is quicksort. It is popular because it is fast—really fast—when compared to other algorithms for similar types of workloads. Key to its speed is that quicksort is a divide-and-conquer algorithm. It is called that because of how it breaks up its work. Instead of eating a giant chunk of data in one bite and chewing it over a long period of time (kinda like an anaconda), quicksort breaks up its data into smaller pieces and chews on each smaller piece quickly.

In this in-depth chapter, we go a tad more precise and really understand how quicksort works. By the end of the chapter, you’ll be able to regale your friends and family (over dinner, preferably) with all ...

Get Absolute Beginner's Guide to Algorithms: A Practical Introduction to Data Structures and Algorithms in JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.