Hello!
I need some help with writing a binary tree class. There are two methods that I have no idea how to approach:
1) Finding the left-most leaf.
Example:
...............A............
............../.\...........
.............B...C...........
............/..../\..........
...........D....E..F........
.............../..............
..............G..............
............./..............
............H..............
.........../..............
..........I..............
In this case, "I" would be the left-most leaf. Now, I have to write a method that returns a pointer to it.
My guess is that it would involve recursion in some way (basically, going down all the possible paths) and a static variable that would increase by 1 if it goes down a left path and decrease by one if it goes down a right path. Therefore, the path on which the variable gets the largest value is the path to the left leaf. But I dunno how to right this down in code. Besides, I dunno if it'll help in some way to return the pointer to the left-most leaf.
2) Deleting the left-most leaf. This, I have no idea how to do at all.