MCPcopy Create free account
hub / github.com/catboost/catboost / QuickSort

Method QuickSort

util/generic/intrlist.h:576–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574
575 template <class TComparer>
576 inline void QuickSort(TComparer&& comparer) {
577 if (Begin() == End() || ++Begin() == End()) {
578 return;
579 }
580
581 T* const pivot = PopFront();
582 TIntrusiveList bigger;
583 TIterator i = Begin();
584
585 while (i != End()) {
586 if (comparer(*pivot, *i)) {
587 bigger.PushBack(&*i++);
588 } else {
589 ++i;
590 }
591 }
592
593 this->QuickSort(comparer);
594 bigger.QuickSort(comparer);
595
596 PushBack(pivot);
597 Append(bigger);
598 }
599
600private:
601 inline TIntrusiveList(const TIntrusiveList&) = delete;

Callers 2

ExecuteMethod · 0.80
TestQuickSortMethod · 0.80

Calls 3

BeginClass · 0.85
AppendFunction · 0.50
PushBackMethod · 0.45

Tested by 1

TestQuickSortMethod · 0.64