562
if (!node.mid && !node.value) {
563
if (node.left && node.right) {
565
>
// replace deleted-node with the min-node of the right branch.
566
>
// If there is no true min-node leave things as they are
567
>
const stack2: typeof stack = [[Dir.Right, node]];
568
>
const min = this._min(node.right, stack2);
569
>
570
>
if (min.key) {
571
>
572
>
node.key = min.key;
573
>
node.value = min.value;
574
>
node.segment = min.segment;
575
>
576
>
// remove NODE (inorder successor can only have right child)
577
>
const newChild = min.right;
578
>
if (stack2.length > 1) {
579
const [dir, parent] = stack2[stack2.length - 1];
580
switch (dir) {