This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
/** | |
* quickselect is a selection algorithm to find the kth smallest element in an | |
* unordered list. Like quicksort, it is efficient in practice and has good | |
* average-case performance, but has poor worst-case performance. Quickselect | |
* and variants is the selection algorithm most often used in efficient | |
* real-world implementations. | |
* | |
* Quickselect uses the same overall approach as quicksort, choosing one |