Answered Essay: Let T(d) be a complete balanced binary tree of depth d. T(1), shown in Fig. 2.24(a), has a root and two leaves. T(d) is obtained by attaching to ea

2.3 Let T(d) be a complete balanced binary tree of depth d. T(1), shown in Fig. 2.24(a) has a root and two leaves. T(d) is obtained by attaching to each of the leaves of T (1) copies of T (d-1). T(3) is shown in Fig. 2.24(b a) Show by induction that T(d) has 2d leaves and 21 non-leaf vertices. b) Show that any binary tree (each vertex except leaves has two descendants) with n leaves has n 1 non-leaf vertices and depth at least [log2 n

Let T(d) be a complete balanced binary tree of depth d. T(1), shown in Fig. 2.24(a), has a root and two leaves. T(d) is obtained by attaching to each of the leaves of T (1) copies of T (d – 1). T(3) is shown in Fig. 2.24(b). a) Show by induction that T(d) has 2^d leaves and 2^d – 1 non-leaf vertices. b) Show that any binary tree (each vertex except leaves has two descendants) with n leaves has n – 1 non-leaf vertices and depth at least [log_2 n].

Expert Answer

 

Solution:

a)

So definition of the complete binary tree is that ” Every node in the tree will have either no children or two children.

Initial step:

So we have T(1) which has total 3 vertices out of which 1 is non-leaf and two are leaf nodes.

number of leaf node T(1)= 2^1= 2, which is true as shown in the picture.

number of non-leaf nodes T(1)= (2^d)-1= 2-1= 1, which is also true as shown in the picture.

Inductive Step:

Now with d= 2, our complete binary tree will look like this

Here we can see that the depth is 2 and total 7 nodes are present, out of which 3 nodes are non-leaf and 4 are leaf nodes.

T(2)= 2^2= 4 leaf nodes,

T(2)= (2^2)-1= 4-1= 3 non-leaf nodes,

Now,

T(3) has 15 nodes in which 8 are leaf nodes and 7 are non-leaf nodes.

We can observe the pattern here total number of nodes= 2^(d+1),

number of leaf nodes= 2^d and

number of non leaf nodes= 2^(d)-1

We can verify our result here by adding 2^(d)-1 and 2^(d) we should get 2^(d+1)-1

2^(d)-1+ 2^(d)= 2*2d-1= 2^(d+1)-1.

b)

Now, a binary tree with n leaf and n-1 non-leaf nodes is a complete binary tree.

Let’s say the depth of this tree is d, then

n= 2^d as shown above,

Number of non-leaf nodes= Total number of nodes- number of leaf nodes= 2^(d+1)+ 2^d= 2(^d-1).

take log of both the sides,

log2 n= log2 2^d

log2 n= d log2 2= d

So, d= log2 n

This means that depth of a complete binary tree is at least left lceil log2 n right rceil .

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?