Introselect

In computer science, introselect (short for "introspective selection") is a selection algorithm that is a hybrid of quickselect and median of medians which has fast average performance and optimal worst-case performance. Introselect is related to the introsort sorting algorithm: these are analogous refinements of the basic quickselect and quicksort algorithms, in that they both start with the quick algorithm, which has good average performance and low overhead, but fall back to an optimal worst-case algorithm (with higher overhead) if the quick algorithm does not progress rapidly enough. Both algorithms were introduced by David Musser in (Musser 1997), with the purpose of providing generic algorithms for the C++ Standard Library that have both fast average performance and optimal worst-case performance, thus allowing the performance requirements to be tightened.

Introselect (Musser)
ClassSelection algorithm
Data structureArray
Worst-case performanceO(n)
Best-case performanceO(n)
Introselect (QuickselectHeapselect)
ClassSelection algorithm
Data structureArray
Worst-case performanceO(n log n)
Best-case performanceO(n)

However, in most C++ Standard Library implementations, a different "introselect" algorithm is used, which combines quickselect and heapselect, and has a worst-case running time of O(n log n). The C++ draft standard, as of 2022, does not have requirements on the worst-case performance, therefore allowing such choice.

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.