It fascinates me when we talked about new data structure. Tree and binary tree were introduced to us recently.
We started with the basic stuff, defining what kinda attributes should trees contain, like the data of the root node, and the branches nodes of its children. Then we talked about how to measure its height, the number of its leaf by using recursion. It's very abstract to me at first, how would we accumulate number by calling one function over and over again? The functionality blew my mind. Danny talked about the essence of recursion - the base case, and then a general case where recursion is to be used.
Binary tree and binary search tree are shortly introduced. Similar to the general tree, but binary tree has the limitation which only takes branches by two. This give it a great capability when sorting numbers in binary search tree - smaller number goes to left whereas bigger number goes to right of the tree node.
No comments:
Post a Comment