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

◆ merge_in() [2/2]

int partition_table::merge_in ( int x,
int y )
private

Definition at line 43 of file hilb.cpp.

45{
46 int t, newtop;
47 int i = x;
48 int j = y;
49 while (dad[i] >= 0) i = dad[i];
50 while (dad[j] >= 0) j = dad[j];
51 if (i == j) return i;
52 n_sets--;
53 if (dad[i] > dad[j])
54 {
55 newtop = j;
56 dad[newtop] += dad[i];
57 dad[i] = newtop;
58 }
59 else
60 {
61 newtop = i;
62 dad[newtop] += dad[j];
63 dad[j] = newtop;
64 }
65 while (dad[x] >= 0)
66 {
67 t = x;
68 x = dad[x];
69 dad[t] = newtop;
70 }
71 while (dad[y] >= 0)
72 {
73 t = y;
74 y = dad[y];
75 dad[t] = newtop;
76 }
77
78 return newtop;
79}
volatile int x

References dad, n_sets, and x.

Referenced by merge_in(), and partition().