Last active
January 6, 2018 21:44
-
-
Save sarahzhao25/41fa7849acce3b679050273498b229da to your computer and use it in GitHub Desktop.
Height function of a BST
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
BinarySearchTree.prototype.height = function(treeNode) { | |
return (treeNode === null) ? -1 : Math.max(this.height(treeNode.left), this.height(treeNode.right)) + 1; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment