Created
January 27, 2018 14:53
-
-
Save sarahzhao25/7822547cea10d741709f899d1754a6b3 to your computer and use it in GitHub Desktop.
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
//ROOT Tree: | |
{ | |
this.value = 15; | |
this.left = BST(10); | |
this.right = null; | |
this.parent = {node: BST(20), side: 'left'}; | |
} | |
//root.height() => 2; | |
//root.balanceFactor() => 2; | |
//PIVOT Tree (left of root): | |
{ | |
this.value = 10; | |
this.left = BST(7); | |
this.right = null; | |
this.parent = {node: BST(15), side: 'left'}; | |
} | |
//pivot.height() => 1; | |
//pivot.balanceFactor() => 1; | |
//PARENT Tree (of root): | |
{ | |
this.value = 20; | |
this.left = BST(15); | |
this.right = BST(25); | |
this.parent = {node: null, side: ''} | |
} | |
//parent.height() => 3; | |
//parent.balanceFactor() => 2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment