| 576 | } |
| 577 | |
| 578 | insertInLeaf(i: index, key: K, value: V, tree: BTree<K, V>) { |
| 579 | this.keys.splice(i, 0, key) |
| 580 | if (this.values === undefVals) { |
| 581 | while (undefVals.length < tree._maxNodeSize) undefVals.push(undefined) |
| 582 | if (value === undefined) { |
| 583 | return true |
| 584 | } else { |
| 585 | this.values = undefVals.slice(0, this.keys.length - 1) |
| 586 | } |
| 587 | } |
| 588 | this.values.splice(i, 0, value) |
| 589 | return true |
| 590 | } |
| 591 | |
| 592 | takeFromRight(rhs: BNode<K, V>) { |
| 593 | // Reminder: parent node must update its copy of key for this node |