answersLogoWhite

0


Best Answer

Check this out! http://stackoverflow.com/questions/575772/the-best-way-to-calculate-the-height-in-a-binary-search-tree-balancing-an-avl

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How to find height of subtree in a Binary tree?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can you know balance factor of height balance tree?

we can find the balance factor of highty balance tree with height of left subtree- height of right sub tree


What is binary search in data structure using c?

a tree which has atmost two nodes is called binary tree binary search tree is a binary tree which satisfies the following 1.every node in tree must be distinct 2.values in right subtree > value at root 3.values in left subtree < value at root 4.left,right subtrees must be binary search trees


What is strictly binary tree?

If every non-terminal node (any node except root node whose degree is not zero) in a binary tree consists of non-empty left and right subtree, then such a tree is called strictly binary tree.


The height of Complete Binary tree is in terms of :option1. n2. logn3. n^2?

The height of a complete binary tree is in terms of log(n) where n is the number of nodes in the tree. The height of a complete binary tree is the maximum number of edges from the root to a leaf, and in a complete binary tree, the number of leaf nodes is equal to the number of internal nodes plus 1. Since the number of leaf nodes in a complete binary tree is equal to 2^h where h is the height of the tree, we can use log2 to find the height of a complete binary tree in terms of the number of nodes.


What is Minimum number of nodes in an AVL tree whose height is h?

2h-1 !! if h is the height of d adjacent subtree.


What is the difference between avl tree and binary tree?

A binary tree is a tree data structure in which each node has at most two children. Typically the child nodes are called left and right. One common use of binary trees is binary search trees; another is binary heaps. A binary search tree (BST) is a binary tree data structure which has the following properties: ->each node has a value; ->a total order is defined on these values; ->the left subtree of a node contains only values less than the node's value; ->the right subtree of a node contains only values greater than or equal to the node's value. An AVL tree is a self-balancing binary search tree. In an AVL tree the heights of the two child subtrees of any node differ by at most one, therefore it is also called height-balanced. Lookup, insertion, and deletion all take O(log n) time in both the average and worst cases. Additions and deletions may require the tree to be rebalanced by one or more tree rotations.


What are the properties of binary tree?

A binary tree of n elements has n-1 edgesA binary tree of height h has at least h and at most 2h - 1 elementsThe height of a binary tree with n elements is at most n and at least ?log2 (n+1)?


What is the height of binary search tree in worst case?

In the worst case a binary search tree is linear and has a height equal to the number of nodes. so h=O(h).


What is the difference between extended binary tree and a binary search tree?

A strictly binary tree is one where every node other than the leaves has exactly 2 child nodes. Such trees are also known as 2-trees or full binary trees. An extended binary tree is a tree that has been transformed into a full binary tree. This transformation is achieved by inserting special "external" nodes such that every "internal" node has exactly two children.


What is complexity of binary search tree?

The complexity of binary search tree : Search , Insertion and Deletion is O(h) . and the Height can be of O(n) ( if the tree is a skew tree). For Balanced Binary Trees , the Order is O(log n).


Minimum height of a binary tree having 1000 nodes?

11


What is the height of a binary tree with n nodes in the worst case?

For the height `h' of a binary tree, for which no further attributes are given than the number `n' of nodes, holds:ceil( ld n)