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

Write a program using one dimensional array that accept five values from the keyboard. Then it should also accept a number to search. This number is to be searched if it among the five input values. If it is found, display the message “Search number is found!” otherwise, display “Search is lost”. Example: Enter 5 numbers: 10 15 20 7 8 Enter number to search: 7 Search number is found!

2 Answers   College School Exams Tests,


readers and writers problem

1 Answers   Cognizant,


write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

0 Answers   Jomo Kenyatta University,


write a program using virtual function to find the transposing of a square matrix?

0 Answers  


. Remove all the blank spaces between character.Matrix is of 10* 10. eg: INPUT ------------------------------------ | N | A | | V | |T ------------------------------------- | |G | U | |P | -------------------------------------- |T | | | A | | ------------------------------------ OUTPUT: ------------------------------------ | N | A | V | T | | ------------------------------------- |G |U | P | | | -------------------------------------- |T | A | | | | ------------------------------------

2 Answers   Nagarro,






write a program to convert temperature from fa height into celcius and vise versa,use modular programming

0 Answers   Jomo Kenyatta University,


1. Write a program that performs the following. The user inputs a number and then enters a series of numbers from 1 to that number. Your program should determine which number (or numbers) is missing or duplicated in the series, if any. For example, if the user entered 5 as the initial number and then entered the following sequences, the results should be as shown. Input Sequence Output ---------------------- --------------- 1 2 3 4 5 Nothing bad However, if 7 were the high number, the user would see the results on the right for the following number entries: Input Sequence Output ---------------------- --------------- 1 3 2 4 5 Missing 6 Missing 7 And if 10 were the high number and the user entered the numbers shown on the left, note the list of missing and duplicate numbers: Input Sequence Output ---------------------- --------------- 1 2 4 7 4 4 5 10 8 2 6 Duplicate 2 ( 2 times) Missing 3 Duplicate 4 ( 3 times ) Missing 9

1 Answers  


Write an algorithm that receives a string and reverses it.

2 Answers  


We need to write the function to check the password entered is correct or not based on the following conditions.. a) It must have atleast one lower case character and one digit. b)It must not have any Upper case characters and any special characters c) length should be b/w 5-12. d) It should not have any same immediate patterns like abcanan1 : not acceptable coz of an an pattern abc11se: not acceptable, coz of pattern 11 123sd123 : acceptable, as not immediate pattern adfasdsdf : not acceptable, as no digits Aasdfasd12: not acceptable, as have uppercase character

0 Answers  


Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

0 Answers  


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,


write a program to calculate the radius for a quadratic equation use modular programming(function abitraction)hint use quadratic function

1 Answers   ICAN, Jomo Kenyatta University,


Categories