Skip to content

Commit 6b9a4e8

Browse files
committed
fix(bst): some typos on the code
1 parent 3c32d0e commit 6b9a4e8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/data-structures/trees/binary-search-tree.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,14 @@ class BinarySearchTree {
249249
/**
250250
* Represent Binary Tree as an array.
251251
*
252-
* Leaf nodes will have two `undefined` descendents.
252+
* Leaf nodes will have two `undefined` descendants.
253253
*
254254
* The array representation of the binary tree is as follows:
255255
*
256256
* First element (index=0) is the root.
257-
* The following two elements (index=1,2) are descendents of the root: left (a) and right (b).
258-
* The next two elements (index=3,4) are the descendents of a
259-
* The next two elements (index=5,6) are the descendents of b and so on.
257+
* The following two elements (index=1,2) are descendants of the root: left (a) and right (b).
258+
* The next two elements (index=3,4) are the descendants of a
259+
* The next two elements (index=5,6) are the descendants of b and so on.
260260
*
261261
* 0 1 2 3 4 5 6 n
262262
* [root, a=root.left, b=root.right, a.left, a.right, b.left, b.right, ...]

src/data-structures/trees/binary-tree-node.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class BinaryTreeNode {
1919

2020
// tag::setAndUpdateParent[]
2121
/**
22-
* Set a left node descendents.
22+
* Set a left node descendants.
2323
* Also, children get associated to parent.
2424
*/
2525
setLeftAndUpdateParent(node) {
@@ -31,7 +31,7 @@ class BinaryTreeNode {
3131
}
3232

3333
/**
34-
* Set a right node descendents.
34+
* Set a right node descendants.
3535
* Also, children get associated to parent.
3636
*/
3737
setRightAndUpdateParent(node) {
@@ -71,7 +71,7 @@ class BinaryTreeNode {
7171
}
7272

7373
/**
74-
* Node is leaf is it has no descendents
74+
* Node is leaf is it has no descendants
7575
*/
7676
get isLeaf() {
7777
return !this.left && !this.right;

0 commit comments

Comments
 (0)