Create a binary tree ADT that includes generic traversal methods that take a visitor, as described in Section 5.2. Write functions count and BSTcheck of Section 5.2 as visitors to be used with the generic traversal method.
The Huffman coding tree function buildHuff of Figure 5.29 manipulates a sorted list. This could result in a Θ(n2) algorithm, because placing an intermediate Huffman tree on the list could take Θ(n) time. Revise this algorithm to use a priority queue based on a min-heap instead of a list.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here