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