diff --git a/src/data-structures/trees/binary-search-tree.js b/src/data-structures/trees/binary-search-tree.js index 43900c54..5e9ffb86 100644 --- a/src/data-structures/trees/binary-search-tree.js +++ b/src/data-structures/trees/binary-search-tree.js @@ -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, ...] diff --git a/src/data-structures/trees/binary-tree-node.js b/src/data-structures/trees/binary-tree-node.js index 69ae1cbf..781b080d 100644 --- a/src/data-structures/trees/binary-tree-node.js +++ b/src/data-structures/trees/binary-tree-node.js @@ -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) { @@ -31,7 +31,7 @@ class BinaryTreeNode { } /** - * Set a right node descendents. + * Set a right node descendants. * Also, children get associated to parent. */ setRightAndUpdateParent(node) { @@ -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;