Question: how to write this function in c++ given the psudeo code. Balance Tree node: Pointer Reference to node Arguments Return Type None Description Balance Factor
how to write this function in c++ given the psudeo code.

Balance Tree node: Pointer Reference to node Arguments Return Type None Description Balance Factor determines if a node and its children need to be rotated, and if so what rotation should occur. Balance Factor is called in Insert and Delete methods. Pseudocode 1. 2. Get the balance Factor of the Node If the node doesn't need balancing: a. Return and do nothing 3. Else a. If the tree is left heavy: i. If temps left child has a left child 1. Perform a right single rotation ii. Else 1. Perform a Left Right rotation b. If the tree is right heavy: 1. 1. i. If temps right child has a right child Perform a left single rotation ii. Else Perform a Right Left rotation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
