This is a blog about trees. Trees are data structures with nodes and they have children. They store a value and they we can visit their children through the nodes. This is good for storing multiple level of memory. In labs I just learned how to visit every node of the tree and I used recursion. The idea is simply calling on every children of the node and stops when the node say we don't have children anymore.
Using recursion in tree is awesome because we can visit every value and go to the every node unless the function reached a node with no children. This is good in a lot of ways. We can search every part of the tree and know how many node meet the requirement of our condition.
No comments:
Post a Comment