Hello my dear readers!
Last week in lecture, we talked about binary search trees (BST) and it was... really cool!
![]() |
| http://www.jade-cheng.com/uh/ta/ics-211-spring-2010/faq/bst.png |
A binary search tree, when populated with numbers, or anything that can be ordered really, is extremely easy to traverse and find what you need. That's because all the nodes are organized when put into the tree. In the tree displayed above, 20 is the root of this BST. This root has 2 children, 10 and 30. Note that 10 is on the left of 20 and 30 is to the right of 20. This is really important because that is how the tree is organized. If you keep looking at the children of 10 and 30, you'll notice that all nodes left of 10 and 30 are less than the respective nodes and anything to the right would be greater. This makes traversal amazingly quick and efficient.
The lab for that week was on BST insertion and deletion which was quite straight forward since we have learned about trees before, so adding the extra feature of left and right nodes (since BInary trees will only have a maximum of 2 children) was not too hard at all.
That is all for this week, friends!
Lana :)

Comments
Post a Comment