Macaulay2 Engine
Loading...
Searching...
No Matches

◆ sort_compares()

void res_comp::sort_compares ( res_pair *& p) const
private

Definition at line 544 of file res-a1.cpp.

545{
546 // These elements are sorted in ascending 'me' values
547 if (p == nullptr || p->next_compare == nullptr) return;
548 res_pair *p1 = nullptr;
549 res_pair *p2 = nullptr;
550 while (p != nullptr)
551 {
552 res_pair *tmp = p;
553 p = p->next_compare;
554 tmp->next_compare = p1;
555 p1 = tmp;
556
557 if (p == nullptr) break;
558 tmp = p;
559 p = p->next_compare;
560 tmp->next_compare = p2;
561 p2 = tmp;
562 }
563
565 sort_compares(p2);
566 p = merge_compares(p1, p2);
567}
void sort_compares(res_pair *&p) const
Definition res-a1.cpp:544
res_pair * merge_compares(res_pair *f, res_pair *g) const
Definition res-a1.cpp:511
res_pair * next_compare
int p
int p1

References merge_compares(), res_pair::next_compare, p, p1, and sort_compares().

Referenced by set_compare_nums(), and sort_compares().