Tree structures
Before we begin, we need to detail a few characteristics our tree structure will possess. For starters, we are going to create an ordered tree so we are not going to allow duplicate values to be added, which will simplify our implementation. Also, we are going to restrict each node to two child nodes. Technically this means we are defining a binary tree structure, but for now we are going to ignore the specific advantages and applications of such a structure and examine that definition in more detail later. Next, our structure is going to implement data and children operations by simply exposing the underlying objects contained in each node. We will not be implementing the parent operation because we have no need to traverse the tree backward at this time.
The insert operation will be implemented as two separate methods supporting raw data and an existing node, while the graft operation will only support existing nodes. Due to our decision not to permit duplicates, the graft...