Thursday, February 05, 2004
A Walk in the Arboretum
Recursive algorithms are useful for traversing the hierarchy of a tree data structure. Starting from the base node a subroutine can continuously call itself with the children of that node as arguments until it reaches the desired depth or node of the tree. Nodes encountered without children are known as a leaf nodes. It is at the leaf nodes that growth occurs. It is at the leaf nodes that we define the frontier of the collection. It is the leaf nodes that contain all the relevant data, the other nodes exist solely as a means to organize and systematically access them. When was the last time that your leaf nodes were accessed? How deep have you allowed the recursion to go? Are you only working with the organization and access system or are you pushing out the frontier? Every leaf node is a potential parent. Some people focus on building a tree in their minds while others believe that the tree already exists and patiently waits to be traversed. As usual the truth is probably some balance between the two.