answersLogoWhite

0


Best Answer

struct node { int payload; struct node *left, *right; };

int height(struct node *tree) {

if (tree == NULL) return 0;

return 1 + max (height (tree->left), height (tree->right));

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

There is a pseudo-code description of an algorithm at http://www.eecs.umich.edu/~qstout/abs/CACM86.html (the site explains the basic idea, and points to the paper that has the detailed algorithm). The tree produced is perfect, in that it has minimal height and a minimal number of nodes at the maximum depth. It is easy to turn the pseudo-code into code in any language. Quentin F. Stout A disclosure: it's one of my pages.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

By making a simple ratio and using cross multiplication. I've included a simple equation to accomplish this... here's how this works.

You must wait until day time when the tree is casting a shadow. Take a stick or something else that is short enough to measure its height and push it into the ground vertically and straight. Measure the object's height, base to top, and its shadow, base to the end of the shadow. Make sure to right these numbers down because you will need them later.

Next, measure the shadow the tree is casting.

Now, using your recorded numbers, you can roughly estimate the trees height. Using this equation ---> (ObjectHeight * TreeShadow / Object Shadow = TreeHeight) should give you the trees height fairly accurately. Just make sure you make all your measurements in the same unit of measurement (i.e. inches, feet, cm, etc.)

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Because a binary trees height has nothing to do with the number of items in the tree you will have to find the longest branch by walking the tree node by node.

When you get into the real world a "B tree" is used, if you get to these you will like them over binary (red/black) trees.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

with a mesuring tape or yard stick

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you find the height of a tree?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the formula to find the height of a tree?

tree x width x height divided by 3


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


How to find height of subtree in a Binary tree?

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


What is the height of banyan tree?

it can grow upto 400ft in height


At a certain time of day the angle of elevation of the sun is 30 degree A tree has a shadow that is 25 feet long Find the height of the tree to the nearest foot?

Tan60= 25/Height. Height = 25/Tan60 = 14.43


How can you find the height of tree?

Using trigonometery if you know the length of its shadow and angle of elevation


What is the formula for working out the height of a tree?

Formula for working out height of a tree is (distance from eye to base of tree/distance from eye to base of stick) x length of stick = tree height.(distance from eye to base of tree/distance from eye to base of stick) x length of stick = tree height is the formula for working out height of a tree.


What is the height and width of the Rockefeller tree in New York?

All i can find is that the The tree, usually a Norway Spruce (a pine i think) is about 75 to 90 feet (23 to 27 m) tall. Every year they erect a different tree i think, so the height varies.Cant find width :P


What is the average height of a Joshua tree?

The average height of a Joshua Tree is 17in.


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 the height of the tree iluvbatar?

the height is (20.5)


Simple angle of elevation word problem?

A simple angle of elevation problem...You want to find out the height of a tree. You measure the distance from you to the base and find that it is 100 feet. You measure the angle of elevation of the top and find that it is 30 degrees. You are six feet tall. How tall is the tree?Answer: The tree is 64 feet tall. Its height is tangent 30 times 100 + 6.