sort.h 843 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <contrib/libs/miniselect/include/miniselect/floyd_rivest_select.h>
  3. namespace NYql {
  4. template <class RandomIt>
  5. void FastNthElement(RandomIt first, RandomIt middle, RandomIt last) {
  6. ::miniselect::floyd_rivest_select(first, middle, last);
  7. }
  8. template <class RandomIt, class Compare>
  9. void FastNthElement(RandomIt first, RandomIt middle, RandomIt last, Compare compare) {
  10. ::miniselect::floyd_rivest_select(first, middle, last, compare);
  11. }
  12. template <class RandomIt>
  13. void FastPartialSort(RandomIt first, RandomIt middle, RandomIt last) {
  14. ::miniselect::floyd_rivest_partial_sort(first, middle, last);
  15. }
  16. template <class RandomIt, class Compare>
  17. void FastPartialSort(RandomIt first, RandomIt middle, RandomIt last, Compare compare) {
  18. ::miniselect::floyd_rivest_partial_sort(first, middle, last, compare);
  19. }
  20. }