I have a binary tree which contains individuals with various ID numbers. I need to search the tree for a specific ID# and return if found. Any help would be appricated. Not sure where to start
Thks,
Brandon
Printable View
I have a binary tree which contains individuals with various ID numbers. I need to search the tree for a specific ID# and return if found. Any help would be appricated. Not sure where to start
Thks,
Brandon
Assuming its a sorted binary tree (which is the point of same) then you start at the root node. If the id of this is greater than the one you need check the left node else check the right node. Iterate while not found and left/right node exists.