-
-
Save danlark1/59d0726f6624c08202ff2653b3563b0a to your computer and use it in GitHub Desktop.
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
// Use Tuckey's ninther technique or median of 3 for pivot selection. | |
// Get the median out of 3 medians of 9 elements | |
// (first, first + half, last - 1) | |
// (first + 1, first + half - 1, last - 2) | |
// (first + 2, first + half + 1, last - 3) | |
_VSTD::__sort3<_Compare>(__first, | |
__first + __half_len, | |
__last - difference_type(1), | |
__comp); | |
_VSTD::__sort3<_Compare>(__first + difference_type(1), | |
__first + (__half_len - 1), | |
__last - difference_type(2), | |
__comp); | |
_VSTD::__sort3<_Compare>(__first + difference_type(2), | |
__first + (__half_len + 1), | |
__last - difference_type(3), | |
__comp); | |
_VSTD::__sort3<_Compare>(__first + (__half_len - 1), | |
__first + __half_len, | |
__first + (__half_len + 1), | |
__comp); | |
_VSTD::iter_swap(__first, __first + __half_len); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mispelling: It is "Tukey's" ninther not "Tuckey's"