Question: Using Python. Trees: implement a list of children loctree.py and leftmost-child right-sibling lcrstree.py , using these operations: PARENT(n,T): returns the parent of node n in
Using Python.
Trees: implement a list of children loctree.py and leftmost-child right-sibling lcrstree.py, using these operations:
PARENT(n,T): returns the parent of node n in Tree T. LEFTMOST_CHILD(n,T): returns the leftmost child of node n in tree T. RIGHT_SIBLING(n,T): returns the right sibling of node n in tree T. LABEL(n,T): returns the label of node n in tree T. CREATE i (v, T1,T2,,Ti): This is on of an infinite family of functions, one for each value of i = 0,1,2,. . CREATE i makes a new node r with label v and gives it I children, which are the roots of trees T1, T2 Ti, in order from the left. The tree with root r is returned.
ROOT(T): returns the node that is the root of tree T.
MAKENULL(T): makes T be the null tree.
**Include the test code in each program so it tests all the above functions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
