Last active
August 29, 2015 14:05
-
-
Save Who828/6f4450289c8cf4812f83 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
6 | |
4 7 | |
2 5 10 | |
insert(9) | |
new_root node (6) | |
go right as val greater then 6 | |
(create a new node for 6) | |
also point new_root to 4 (left side) | |
go right as val greater then 7 | |
(create a new node for 7) | |
No need to point to left side as already null | |
go left as val less then 10 | |
(create a new node for 10) | |
assign new val there. | |
return new_root | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment