Starting from:

$29.99

lab 6: AVL Tree

COSC 2436 lab 6: AVL Tree
1. Introduction
For this lab, you will construct a self-balanced AVL tree from the given input. AVL tree is
a form of binary search tree but it will rebalance itself after each insertion. A binary tree
said to be balanced if the difference between the heights of left and right subtree of
every node in the tree is either -1, 0, or 1.
2. Input and Output
a. Input file
 The first line in the input will contain an integer n, denote the number of
nodes to be inserted into the tree.
 Each line of the following n lines will contain a single integer to be
inserted into the tree.
 Input will have no empty lines or spaces.
 There will be no duplicate nodes.
b. Output file
 Output the tree in level order, with each node separated by a space
 Note: no space after the last output node
3. Example Output
input1.txt
5
1
2
3
4
5
output1.txt
2 1 4 3 5
Visualization:
4. Turn in your lab assignment
Lab 6 needs to be turned in to our Linux server, follow the link here
https://rizk.netlify.app/courses/cosc2430/2_resources/
Make sure to create a folder under your root directory, name it lab6 (name need to be
lower case), copy your code and argumentmanager.h to this folder, no testcase or other
files needed.
PS: This document may have typos, if you think something illogical, please email TAs for
confirmation.

More products