Last active
August 29, 2017 19:12
-
-
Save scriptonian/b8c01582d1dbae17311bd5a034f5779c to your computer and use it in GitHub Desktop.
Binary Search Tree Class Shell
This file contains 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
//ES5 version | |
function TreeNode(keyValue) { | |
this.keyValue = keyValue; | |
this.left = null; | |
this.right = null; | |
this.toString = function() { | |
return this.keyValue; | |
} | |
} | |
function BinarySearchTree() { | |
var rootNode = null; | |
} |
This file contains 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
//ES2015 & beyond version | |
class TreeNode { | |
constructor(keyValue) { | |
this.keyValue = keyValue; | |
this.left = null; | |
this.right = null; | |
} | |
} | |
class BinarySearchTree { | |
constructor() { | |
let rootNode = null; | |
} | |
toString() { | |
return this.keyValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment