|
Heap Tree
Hello all
i need to be practically spoon fed- i need to create a complete binary tree. each time i call this function add() i need to detect where the next empty spot in the tree is is using the two variables, count (the number of nodes in the tree) and height (the depth/number of rows to the tree). I also am passing a pointer to the root of the tree. I was planning on starting at the root and navigating, left to right, until i hit a leaf or a node with only one child.
any suggestions? maybe recursion? i just cant seem to wrap my head around the logic.
Thank you in advance
|