Skip to content

Commit

Permalink
fix(bst): some typos on the code
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed Jan 9, 2021
1 parent 3c32d0e commit 6b9a4e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/data-structures/trees/binary-search-tree.js
Expand Up @@ -249,14 +249,14 @@ class BinarySearchTree {
/**
* Represent Binary Tree as an array.
*
* Leaf nodes will have two `undefined` descendents.
* Leaf nodes will have two `undefined` descendants.
*
* The array representation of the binary tree is as follows:
*
* First element (index=0) is the root.
* The following two elements (index=1,2) are descendents of the root: left (a) and right (b).
* The next two elements (index=3,4) are the descendents of a
* The next two elements (index=5,6) are the descendents of b and so on.
* The following two elements (index=1,2) are descendants of the root: left (a) and right (b).
* The next two elements (index=3,4) are the descendants of a
* The next two elements (index=5,6) are the descendants of b and so on.
*
* 0 1 2 3 4 5 6 n
* [root, a=root.left, b=root.right, a.left, a.right, b.left, b.right, ...]
Expand Down
6 changes: 3 additions & 3 deletions src/data-structures/trees/binary-tree-node.js
Expand Up @@ -19,7 +19,7 @@ class BinaryTreeNode {

// tag::setAndUpdateParent[]
/**
* Set a left node descendents.
* Set a left node descendants.
* Also, children get associated to parent.
*/
setLeftAndUpdateParent(node) {
Expand All @@ -31,7 +31,7 @@ class BinaryTreeNode {
}

/**
* Set a right node descendents.
* Set a right node descendants.
* Also, children get associated to parent.
*/
setRightAndUpdateParent(node) {
Expand Down Expand Up @@ -71,7 +71,7 @@ class BinaryTreeNode {
}

/**
* Node is leaf is it has no descendents
* Node is leaf is it has no descendants
*/
get isLeaf() {
return !this.left && !this.right;
Expand Down

0 comments on commit 6b9a4e8

Please sign in to comment.