Question: Someone designs a new greedy strategy that constructs the tree in a top down manner as follows, starting from a sorted list in decreasing order
Someone designs a new greedy strategy that constructs the tree in a "top down" manner as follows, starting from a sorted list in decreasing order of frequency:
- If there is only one character, return that character as a single node tree.
- Otherwise (recursively) return a tree whose left child is a leaf consisting of the first (highest frequency) character, and the right child is the tree built recursively from the rest of the list.
The height of the tree is
3
2
4
5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
