We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bcad3b6 commit 699fd82Copy full SHA for 699fd82
src/_DataStructures_/Trees/BST/index.js
@@ -104,7 +104,13 @@ class BinarySearchTree {
104
// there is a left sub-tree
105
return root.leftChild;
106
}
107
- // the root contain 2 childs
+ /**
108
+ * the root contain 2 childs, we got 2 options:
109
+ * 1. We can either find the Node with minimum value at from the right sub-tree
110
+ * 2. Or, we can find the Node with maximum value from the left sub-tree
111
+ *
112
+ * I'm picking up 1 here
113
+ */
114
const minRightNode = this.findMinNode(root.rightChild);
115
// eslint-disable-next-line no-param-reassign
116
root.value = minRightNode.value;
0 commit comments