Data Systems > STUDY GUIDE > HW6.txt - Syracuse University CSE 674 (All)
//HW6 AVL Tree //Due: Saturday (Nov. 24) at 11:59PM //total point: 60 #include <iostream> //to use cout #include <algorithm> //to use max function such as i = max(a, b); using namespace std; //Y... ou need to use the following node class for each node of the AVL tree class node { public: int value; int height; bool is_left_child; //true if this node is the left child of its parent node; else false; bool is_right_child; //true if this node is the right child of its parent node; else false; node * parent; node * l_child; node * r_child; node() {} node(int i) { value = i; height = 1; parent = l_child = r_child = nullptr; is_left_child = is_right_child = false; } }; class avl_tree { public: node * root; avl_tree() { root = nullptr; } void add_node(int i);//You need to implement this. //When there is a tie of values, continue the search toward the child branch with smaller height. //If both left and right child branch carry the same height, continue the search toward the right child branch. void in_order_traversal(node *p); //provided. void height_adjustment(node *p, node * &action_node_pointer, int &pattern); //You need to implement this /* // You need to implement this. This function is invoked by add_node and remove_node. p points to the first node that we need to check for possible height update. We then need to check possible height update toward root. All nodes whose heights need to be updated will be performed in this function. When invoked, action_node_pointer = nullptr, pattern = 0. If no imbalance is detected, action_node_pointer remains nullptr, and pattern [Show More]
Last updated: 1 year ago
Preview 1 out of 9 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Add to cartInstant download
We Accept:
Connected school, study & course
About the document
Uploaded On
Nov 17, 2022
Number of pages
9
Written in
This document has been written for:
Uploaded
Nov 17, 2022
Downloads
0
Views
34
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·