Write pseudo-code not Java for problems requiring code. You are responsible for the appropriate level of detail.
Write pseudo-code not Java for problems requiring code. You are responsible for the appropriate level of detail. For the questions asking for justification, please provide a detailed mathematically oriented discussion. A proof is not required.
- How many ancestors does a node at level n in a binary tree have? Provide justification.
- Prove that a strictly binary tree (regular binary tree) with n leaves contains 2n-1 nodes. Provide justification.
- Explain in detail that if m pointer fields are set aside in each node of a general m-ary tree to point to a maximum of m child nodes, and if the number of nodes in the tree is n, the number of null child pointer fields is n*(m-1)+1.
- Implement maketree, setleft, and setright for right in-threaded binary trees using the sequential array representation.
- Implement inorder traversal for the right in-thread tree in the previous problem.
- Define the Fibonacci binary tree of order n as follows: If n=0 or n=1, the tree consists of a single node. If n>1, the tree consists of a root, with the Fibonacci tree of order n-1 as the left subtree and the Fibonacci tree of order n-2 as the right subtree. Write a method that builds a
Fibonacci binary tree of order n and returns a pointer to it.
- Answer the following questions about Fibonacci binary tree defined in the previous problem.
- Is such a tree strictly binary?
- What is the number of leaves in the Fibonacci tree of order n?
- What is the depth of the Fibonacci tree of order n?
Reviews
There are no reviews yet.