logo

CMSC 3613 Programming Assignment 2022

3 Pages830 Words20 Views
   

Added on  2022-02-09

CMSC 3613 Programming Assignment 2022

   Added on 2022-02-09

ShareRelated Documents
CMSC 3613
Programming Assignment: AVL Tree
Due Date: Check the D2L calendar for the due date.
Assignment:
The task of this project is to implement the rotate_right() and left_balance() functions in the
provided program framework. Those two functions are marked as “TODO” in the comments inside
the file avl_tree.h. Please follow the program structures of rotate_left() and right_balance()
functions and make necessary modifications.
Please pay special attention to the balance factor for each node and the bool value longer.
The format of the input file (e.g. input1.dat) will be similar as:
{insert and delete will be followed by an integer in the next line. Leading or tailing spaces are
not handled, if you want to make it perfect, you can follow the utilities in p01.}
The format of the output will be similar as:
{This is a preorder traversal. In each line, the format is “root_value: left_value right_value”, in
which the value of a null child node is replaced by a dash.}
insert
80
insert
90
insert
100
insert
110
insert
95
insert
120
insert
92
insert
97
insert
70
insert
93
delete
100
delete
80
delete
120
delete
97
++++++++++++++++++++++
92: 90 95
90: 70 -
95: 93 110
++++++++++++++++++++++
CMSC 3613  Programming Assignment 2022_1

End of preview

Want to access all the pages? Upload your documents or become a member.