The implementation of AVL trees described in this chapter introduced two helper methods, Difference and Height, to

Question:

The implementation of AVL trees described in this chapter introduced two helper methods, Difference and Height, to compute the balance factor of a given node. Another approach would be to store the balance factor of each node inside the node itself and update balance factors that change because of an insertion or deletion. 1. What are the pros and cons of such an approach? 2. Modify the AVL implementation to store the balance factor inside a TreeNode. Change the Difference helper function to support this approach.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

C++ Plus Data Structures

ISBN: 9781284089189

6th Edition

Authors: Nell Dale, Chip Weems, Tim Richards

Question Posted: