I have a binary tree, it is strange: the root is the highest number, and the other go decreasing…
(Example: Huffman tree)
I need to make an algorithm that searches a key inside it.
I tried a lot but I had no idea how to do it =(
Any suggestion please?
For example like this
The tree in the image you showed us is a Huffman Tree. The nodes inside this tree represent the number of occurrences of the keys under that node. A node gives you absolutely no information about the keys that can be found from that node.
As you have no information about the keys in a subtree, you have to go through the whole tree to find a key inside it.