Something like this:
int depth (const Tree *root)
{
int l, r;
if (root==NULL) return 0;
l= depth (root->left);
r= depth (root->right);
if (l>r) return return 1+l;
else return 1+r;
}
You recursively descend the tree, taking every possible path, counting the number of nodes, finding the maximum.
Well, that's how to measure it. To calculate it, consider this...
For an ideally balanced binary tree of depth D, the number of nodes N is 2D - 1. Solving for D...
N = 2D - 1
N + 1 = 2D
log2 (N + 1) = D
Weigh it, calculate its volume, then calculate density.
How can you calculate surface density if the volume density is 1.4 g/cm3
== Density== Mass/Volume =) ===
500g
Density is equal to the mass divided by the volume.
by calculate density by dividind the mass of space
How can you calculate surface density if the volume density is 1.4 g/cm3
how do you calculate density
It means: * Calculate the density of an object * Calculate the density of its pieces * Compare
volume/mass= density
density = mass/volume
The density can be measured experimentally.
density = mass/volume
The shape of an object is not enough to calculate its density. You also need its mass and then Density = Mass/Volume.
Mass and volume are needed to calculate the density of a graduated cylinder.
Bulk density = dry weight / volume, then by knowing the dry weight and bulk density we can calculate the volume.
density = mass/volume
== Density== Mass/Volume =) ===