Question: Please i need help with first and second queston please I need help with first and second question The above technique though does not generalize

Please i need help with first and second queston Please i need help with first and second queston please I

please I need help with first and second question

The above technique though does not generalize to arbitrary trees - inorder traversals are only meaningful on binary trees. So we need to design a more flexible algorithm. But first, let's clarify what it means for a grid drawing of a tree to be "nice. For the rest of the problem, assume that references to the children of each node v is stored in v.children. The children are also ordered that is, there is a first child, a second child, etc. - and the children are accessed in the said order. Lastly, assume that every node has an an even number of children, like quadtrees or octrees, etc. Here are the rules: Each node is assigned integer x- and y-coordinates. Two nodes that have the same depth in T are assigned the same y-coordinate. When node v has 2k children, the first k children and their subtrees have c-coordinates smaller than v's c-coordinate while the second set of k chlldren and their subtrees have x-coordinates larger than u's x-coordinate. a. (1 pt.) Briefly explain why the scheme described earlier for assigning x- coordinates to the nodes of the binary tree works. b. (1 pt.) For the tree below, assign the nodes x- and y-coordinates that obey the three rules above. The x-coordinates should range from 1 to 13; the y-coordinates should range from 2 to 0. The above technique though does not generalize to arbitrary trees - inorder traversals are only meaningful on binary trees. So we need to design a more flexible algorithm. But first, let's clarify what it means for a grid drawing of a tree to be "nice. For the rest of the problem, assume that references to the children of each node v is stored in v.children. The children are also ordered that is, there is a first child, a second child, etc. - and the children are accessed in the said order. Lastly, assume that every node has an an even number of children, like quadtrees or octrees, etc. Here are the rules: Each node is assigned integer x- and y-coordinates. Two nodes that have the same depth in T are assigned the same y-coordinate. When node v has 2k children, the first k children and their subtrees have c-coordinates smaller than v's c-coordinate while the second set of k chlldren and their subtrees have x-coordinates larger than u's x-coordinate. a. (1 pt.) Briefly explain why the scheme described earlier for assigning x- coordinates to the nodes of the binary tree works. b. (1 pt.) For the tree below, assign the nodes x- and y-coordinates that obey the three rules above. The x-coordinates should range from 1 to 13; the y-coordinates should range from 2 to 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!