Text: 4. Use the given data below for the tasks in 4A and 4B.
6, 4, 16, 1, 5, 10, 17, 3, 9, 12, 18, 2, 8, 11, 13, 7, 14, 15
A. Write a program to construct a binary tree (linked) from the given data. You are to keep references (pointers) to the parent node, left child, and right child nodes for the next task (Q4B). What is the time complexity?
B. From the unbalanced binary tree created from Q4A, convert it into an AVL balanced tree without using any extra space by rebuilding the tree from the leaf nodes using the concept of AVL height balance factor. What is the time complexity?