Simple Trees

The Simple_tree class is the primitive data structure demonstrated in class meant to highlight the features of a heirarchical tree data structure. This class requires the Single_list class from Project 1.

This uses the recursive definition of a general tree: each node in the tree is itself a tree. Each node has a reference to its parent (set to 0 if the node is a root node) and a singly linked list storing any children.

The void insert( Type const & ) member function can be used to add a new child storing the argument the the current node while void insert( Simple_tree & ) can be used to insert an entire tree as a sub-tree of the current node. The member function void detach() removes the current node from being a child of its parent; essentially converting it into a root node.