Solved
Thanks for all your help.
I solved the problem by creating an array, and traversing the tree and storing each node in the array. Once I had all the nodes in the array, I traversed the array and check whether or not that node was a parent to any other node. If it returned nothing, it means that it's a leaf node.
|