[SOLVED] CS113-HW10-AVLTree

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

AVL Tree (w/o removal)

[![Build Status](https://travis-ci.com/MiraCostaCS-Nery/cs113-hw10-avltree-aguilaraul.svg?token=gQZtppqQzwc3qhE2omLQ&branch=master)](https://travis-ci.com/MiraCostaCS-Nery/cs113-hw10-avltree-aguilaraul)

Complete the `AVLTree` class by coding the missing methods for insertion only (only add, not remove, etc.). Create a driver that insert a collection of more than 20 randomly generated numbers. Insert the same set of numbers in a binary search tree that is not balanced. Verify that each tree is correct by performing an in-order traversal. Also, display the format of each tree that was built and compare their heights.

Make sure you are building the class inheritance diagram in the reading:
`BinaryTree <– BinarySearchTree <– BinarySearchTreeWithRotate <– AVLTree`

> ***NOTE:***
> – Reading the book helps! Ch. 9 has a lot of information and code on AVL trees and the parts required above!
> – Note the following bug in the text’s source code! `rebalanceLeft` on p. 487 does not update the left child’s balance when a right – left imbalance occurs. This would also be the case for left – right imbalances with a `rebalanceRight` implementation based on that `rebalanceLeft`. An additional conditional block is required when checking for left – right- right or left – right – left imbalances.
> – The provided BinaryTree class now includes an additional `toString` method, which displays the given binary tree in such a way that is easier to read through console output.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.