Deriving time complexity of Binary tree and AVL tree, step
by step.

Answers were Sorted based on User's Feedback



Deriving time complexity of Binary tree and AVL tree, step by step...

Answer / tilak chandan

Lemma: A subtree rooted at node v has at least 2bh(v) − 1 internal nodes.
Proof of Lemma (by induction height):
Basis: h(v) = 0
If v has a height of zero then it must be null, therefore bh(v) = 0. So:
2bh(v) − 1 = 20 − 1 = 1 − 1 = 0
Inductive Step: v such that h(v) = k, has at least 2bh(v) − 1 internal nodes implies that v' such that h(v') = k+1 has at least 2bh(v') − 1 internal nodes.
Since v' has h(v') > 0 it is an internal node. As such it has two children each of which have a black-height of either bh(v') or bh(v')-1 (depending on whether the child is red or black, respectively). By the inductive hypothesis each child has at least 2bh(v') − 1 − 1 internal nodes, so v' has at least:
2bh(v') − 1 − 1 + 2bh(v') − 1 − 1 + 1 = 2bh(v') − 1
internal nodes.
Using this lemma we can now show that the height of the tree is logarithmic. Since at least half of the nodes on any path from the root to a leaf are black (property 4 of a red black tree), the black-height of the root is at least h(root)/2. By the lemma we get:

Therefore the height of the root is O(log(n)).

Is This Answer Correct ?    2 Yes 1 No

Deriving time complexity of Binary tree and AVL tree, step by step...

Answer / pudwallis gudzinsky

I do not know the answer either. In fact, I do not believe
that a question was asked. Therefore, I feel that this is
a trick non-question. If the question was "Do I like tater
tots?" Indeed the answer would be a resounding Yes and I
am 100 percent certain that this answer is correct.

If there are girls available in the room, I would not like
strike with them.

Is This Answer Correct ?    5 Yes 22 No

Deriving time complexity of Binary tree and AVL tree, step by step...

Answer / haresh

Actually i was searching for the same answer as i dont know
what the answer is.. But yah if there are girls in ur room i
will be happy striking with them lol

Is This Answer Correct ?    1 Yes 19 No

Deriving time complexity of Binary tree and AVL tree, step by step...

Answer / ssss ss

I do not know what the answer is .I am subhani and you are
not my friend .However I do not the answer.But you do not
know the answer.You have already told me that i have already
strike with the girls available in the room.

Is This Answer Correct ?    6 Yes 34 No

Post New Answer

More C++ Code Interview Questions

Find the maximum product of three numbers in an array? Eg. 9,5,1,2,3 Max product= 9*5*3= 135 The array can hav negative numbers also..

7 Answers   CTS,


what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }

0 Answers  


Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.

5 Answers   ADP, Amazon, HCL, IBM, Infosys, Satyam, TCS, Vimukti Technologies,


i don't know about working of nested for loop can any one help me

0 Answers  


Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.

0 Answers   Facebook, Webyog, Wipro,






what is the best algorithm to sort out unique words from a list of more than 10 million words(1 crore+)? we need the best technique in the terms of execution time.

9 Answers   TCS,


write a proram using exceptional handling create a error & display the message "THERE IS AN ERROR?... PLEASE RECTIFY"?

1 Answers  


1+1/2!+1/3!+...+1/n!

0 Answers  


using friend function find the maximum number from given two numbers from two different classes.write all necessary functions and constructor for the classes.

1 Answers   TCS,


Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list)

3 Answers   Nagarro,


can you please write a program for deadlock that can detect deadlock and to prevent deadlock.

0 Answers  


Code for Easily Using Hash Table?

0 Answers  


Categories