This week Binary Search Tree is introduced to us. Compare to a Tree, BST is easier to use and understand. It compares each nodes with the root and put the smaller ones on the left tree and the larger ones on the right tree. Then it keep compares everything and do the same. It decreases the working time compare to Tree.
Also, When I'm trying to do implement on BST, it's a lot easier than a Tree. I need to compare the value I'm gonna work with with the root of the BST, after that, I only need to deal with one side of the tree depends on the value is larger or smaller than the value of the root. This way it is a lot faster.
No comments:
Post a Comment