ELI5: Explain Like I'm 5

Quickselect

Quickselect is like finding the biggest ball in a bag of balls. Let's say you have a bag of different sized balls, and you want to find the biggest one without looking at every single ball.

First, you pick a random ball from the bag. This ball is called the "pivot." Then, you move all the balls that are bigger than the pivot to one side of the bag and all the balls that are smaller to the other side.

Now, you can see which side of the bag the biggest ball is on. If the biggest ball is on the side with the smaller balls, you repeat the process with just that side of the bag. If the biggest ball is on the side with the bigger balls, you repeat the process with just that side of the bag.

You keep doing this until you find the biggest ball. This is quicker than looking at every ball individually because you can eliminate half of the bag with each pivot.

Quickselect uses this idea to find the nth biggest number in a list of numbers. Instead of looking for the biggest ball, it finds the nth biggest number in the list by eliminating smaller or larger numbers with each pivot.
Related topics others have asked about: