2022-04-27 21:37:58 +02:00
|
|
|
class RAVLTree extends WAVLTree {
|
|
|
|
isCorrectNode(node, recursive) {
|
|
|
|
if (!node) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-05-01 17:09:46 +02:00
|
|
|
if (!nodeDifferences(node).filter((d) => d <= 0).length > 0) {
|
2022-04-27 21:37:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-05-01 17:09:46 +02:00
|
|
|
return (
|
|
|
|
!recursive ||
|
|
|
|
(this.isCorrectNode(node.left) && this.isCorrectNode(node.right))
|
|
|
|
);
|
2022-04-27 21:37:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
deleteRebalance(node, parent) {
|
|
|
|
// no-op
|
|
|
|
return;
|
|
|
|
}
|
2022-05-01 17:09:46 +02:00
|
|
|
}
|