Last active
February 10, 2024 21:19
-
-
Save helabenkhalfallah/cee97acbd24dae7225b3ff81ca41d71d to your computer and use it in GitHub Desktop.
BinarySearchTreeNode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BinarySearchTreeNode { | |
constructor(key, value = key, parent = null) { | |
this.key = key; | |
this.value = value; | |
this.parent = parent; | |
this.left = null; | |
this.right = null; | |
} | |
get isLeaf() { | |
return this.left === null && this.right === null; | |
} | |
get hasChildren() { | |
return !this.isLeaf; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment