Table of Contents
- 1 What is the maximum possible difference in height between left and right subtree?
- 2 How do you find the difference between two nodes?
- 3 What is the maximum height of any AVL tree with 7 nodes assume that the height of a tree with single node is 0?
- 4 What is the maximum distance between two nodes present in the queue?
- 5 What is the maximum possible number of nodes in a binary tree at Level 6 *?
- 6 What is the maximum number of nodes in an AVL-tree?
- 7 What is the max height of a subtree in a tree?
What is the maximum possible difference in height between left and right subtree?
This new subtree, call it the left subtree of a node will have at most a height difference of 1 with the right subtree on the same node. But this also means that the maximum height difference between any 2 leaves in this entire tree will be 2.
How do you find the difference between two nodes?
The distance between two nodes can be obtained in terms of lowest common ancestor. Following is the formula. Dist(n1, n2) = Dist(root, n1) + Dist(root, n2) – 2*Dist(root, lca) ‘n1’ and ‘n2’ are the two given keys ‘root’ is root of given Binary Tree.
What is the maximum height difference between the leaves of the AVL tree?
7. What maximum difference in heights between the leafs of a AVL tree is possible? Explanation: At every level we can form a tree with difference in height between subtrees to be atmost 1 and so there can be log(n) such levels since height of AVL tree is log(n).
How do you find the maximum number of nodes in a binary tree?
If binary tree has height h, maximum number of nodes will be when all levels are completely full. Total number of nodes will be 2^0 + 2^1 + …. 2^h = 2^(h+1)-1. For example, the binary tree shown in Figure 2(b) with height 2 has 2^(2+1)-1 = 7 nodes.
What is the maximum height of any AVL tree with 7 nodes assume that the height of a tree with single node is 0?
So, the max height with 7 nodes is 3.
What is the maximum distance between two nodes present in the queue?
Discussion Forum
Que. | Regarding implementation of Breadth First Search using queues, what is the maximum distance between two nodes present in the queue? (considering each edge length 1) |
---|---|
b. | 0 |
c. | At most 1 |
d. | Insufficient Information |
Answer:At most 1 |
What is the space between two nodes?
…the stem is called a node, and the region between successive nodes is called an internode.
What maximum difference in height between the leaves of a AVL tree is possible 1 point log n where n is the number of nodes n where n is the number of nodes 0 or 1?
If there are n nodes in AVL tree, maximum height can’t exceed 1.44*log2n. If height of AVL tree is h, maximum number of nodes can be 2h+1 – 1.
What is the maximum possible number of nodes in a binary tree at Level 6 *?
Discussion Forum
Que. | What is the maximum possible number of nodes in a binary tree at level 6? |
---|---|
b. | 6 |
c. | 1 |
d. | 64 |
Answer:64 |
What is the maximum number of nodes in an AVL-tree?
If height of AVL tree is h, maximum number of nodes can be 2 h+1 – 1. N (h) = N (h-1) + N (h-2) + 1 for n>2 where N (0) = 1 and N (1) = 2. The complexity of searching, inserting and deletion in AVL tree is O (log n). What is the worst case time complexity of inserting n 2 elements into an AVL-tree with n elements initially?
How to find the maximum height of a node in a tree?
That height is the minimum. To find the maximum, do the same as for the minimum, but then go back one step (remove the last placed node) and see if adding that node to the opposite sub-tree (from where it just was) violates the AVL tree property. If it does, your max height is just your min height.
What is an AVL tree?
AVL tree is necessarily a binary search tree with an additional property. That property states that difference between height of left sub-tree and right sub-tree of any node can’t be more than 1. This property gives Balance Factor which whose value should be from {-1, 0, 1} in case of AVL tree. Here are some key points about AVL trees:
What is the max height of a subtree in a tree?
The right subtree still has height 3, but the left subtree now has height 4. However these values differ by less than 2, so it is still an AVL tree. Therefore your max height is 4.