Merged
Changes from 1 commit
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Previous commit
Next commit
fix tests
  • Loading branch information
@aspeddro
aspeddro committedMar 10, 2023
commit edcfb61de8e6358d49d2c4f7c812188f9ad1fd27
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,27 +38,27 @@ let bal = (l, x, d, r) => {
}
if hl > hr + 2 {
switch l {
| Empty => assert false
| Empty => assert(false)
| Node(ll, lv, ld, lr, _) =>
if height(ll) >= height(lr) {
create(ll, lv, ld, create(lr, x, d, r))
} else {
switch lr {
| Empty => assert false
| Empty => assert(false)
| Node(lrl, lrv, lrd, lrr, _) =>
create(create(ll, lv, ld, lrl), lrv, lrd, create(lrr, x, d, r))
}
}
}
} else if hr > hl + 2 {
switch r {
| Empty => assert false
| Empty => assert(false)
| Node(rl, rv, rd, rr, _) =>
if height(rr) >= height(rl) {
create(create(l, x, d, rl), rv, rd, rr)
} else {
switch rl {
| Empty => assert false
| Empty => assert(false)
| Node(rll, rlv, rld, rlr, _) =>
create(create(l, x, d, rll), rlv, rld, create(rlr, rv, rd, rr))
}
Expand Down