MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / merge

Method merge

src/class152/FollowUp1.java:53–66  ·  view source on GitHub ↗
(int l, int r)

Source from the content-addressed store, hash-verified

51 }
52
53 public static int merge(int l, int r) {
54 if (l == 0 || r == 0) {
55 return l + r;
56 }
57 if (priority[l] >= priority[r]) {
58 right[l] = merge(right[l], r);
59 up(l);
60 return l;
61 } else {
62 left[r] = merge(l, left[r]);
63 up(r);
64 return r;
65 }
66 }
67
68 public static void add(int num) {
69 split(0, 0, head, num);

Callers 3

addMethod · 0.95
removeMethod · 0.95
rankMethod · 0.95

Calls 1

upMethod · 0.95

Tested by

no test coverage detected