Question

(Algorithm) A binary tree has a height of h=4. What is the number of nodes of...

(Algorithm)

A binary tree has a height of h=4. What is the number of nodes of this binary tree if the tree is:

a) A full binary tree

b) A complete binary tree

Homework Answers

Answer #1

Here, we have height h of a given tree is 4.

i.e. h = 4

Full binary tree :-

A tree is said to be full binary tree if every node has 0 or 2 childrens except leaf nodes.

So, for h=4 we have possibly,

9, 11, 13 and 15 nodes i.e.

Here, we see that all the trees are full binary trees as all all them have 0 or 2 childrens except leaf node.

So, for h = 4 the possible numbers of nodes for full binary tree are 9, 11, 13 and 15.

Complete binary tree :-

In complete binary tree we have all the levels are completely filled except possibly the last level and last level have keys as left as possible.

So, for h = 4 we have possibly,

8, 9, 10, 11 and 15 nodes i.e.

Here, we see that all the all the levels except the last level is completely filled and all the leaves in the last level are all to the left side.

So, for h=4 the number of nodes for complete binary tree are 8, 9, 10, 11 and 15.

Thumbs up!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
(Algorithm) A full binary tree has start node, internal nodes, and leaf nodes. The number of...
(Algorithm) A full binary tree has start node, internal nodes, and leaf nodes. The number of leaf nodes of this binary tree is 256. a) What is the height of the tree? b) How many internal nodes are in the tree?
1. a) Suppose that a binary tree of height h has n nodes. Show that h...
1. a) Suppose that a binary tree of height h has n nodes. Show that h ≥ log2 (n+2) - 1. b) Using the formula in part (a) find the minimum height if a binary tree with 1000 nodes. c) What is the maximum possible height of a binary tree with 1000 nodes?
Maximum how many nodes can there be in a complete Binary Tree with level h?
Maximum how many nodes can there be in a complete Binary Tree with level h?
Maximum how many nodes can there be in a complete Binary Tree with level h? (java...
Maximum how many nodes can there be in a complete Binary Tree with level h? (java programing)
An empty tree has height ________ A tree with just a root and no other nodes...
An empty tree has height ________ A tree with just a root and no other nodes has height___ The root is at depth_____ What is the maximum possible height for a tree with 31 nodes? What is the minimum possible height for a tree with 31 nodes?
Prove that a full non-empty binary tree must have an odd number of nodes via induction
Prove that a full non-empty binary tree must have an odd number of nodes via induction
How many levels will there be in a complete binary tree is it has n number...
How many levels will there be in a complete binary tree is it has n number of nodes? looking for formula
A binary tree isfullif every non-leaf node has exactly two children. For context, recallthat we saw...
A binary tree isfullif every non-leaf node has exactly two children. For context, recallthat we saw in lecture that a binary tree of heighthcan have at most 2h+1−1 nodes, and thatit achieves this maximum if it iscomplete, meaning that it is full and all leaves are at the samedistance from the root. Findμ(h), theminimumnumber of nodes that a full tree of heighthcan have, and prove your answer using ordinary induction onh. Note that tree of height of 0 isa single...
a) Design a recursive linear-time algorithm that tests whether a binary tree is a binary search...
a) Design a recursive linear-time algorithm that tests whether a binary tree is a binary search tree. Describe your algorithm in English or with a simple pseudocode program. b) (3 bonus pts.) Extend the algorithm in a) to test whether a binary tree is an AVL tree.
Question 2 Trees a.) Draw any graph with one connected component and at least five nodes...
Question 2 Trees a.) Draw any graph with one connected component and at least five nodes which is not a tree. b.) Construct a full binary tree with exactly a height of 3. c.) How many leaf nodes does a full 4-ary tree of height 3 support?