| The value you're adding will determain where in teh tree it is going to be located, your seach tree here will always have values less than (or equal to) your value to add placed on the left branch, values higher placed on the right.
So some sort of bubble sort algorithm would do, see if the leaf value is less or equal to, then go right, if higher go left, when leaf holds an empty branch in the intended direction, place value here.
The real problem arises when deleting from the tree, then you'd need a balance function to make sure the tree structurial will allways support your adding scheme.
But most likely this tree handling, beeing adding, deleting or balancing will require some form of recursive calling. |