I am kinda confused on how to calculate the average depth of a tree. Its the max depth divided by the total amount of nodes? Is this correct?

Thanks

Thanks

@Aceix Thanks for being useless. The reason I use this forum is for understanding and checking myself.

6

/ \

3 8

/ \ \

2 4 9

\

5

So average depth is 1.571 because from 6 to 3 has depth of 1 and 6 to 2 has depth of 2. Do that for the rest of the nodes and sum them up then divide by the total number of nodes and that is the average depth. So it's (1 + 1 + 2 + 2 + 2 + 3)/7. Can anyone else verify if this is correct.

6

/ \

3 8

/ \ \

2 4 9

\

5

So average depth is 1.571 because from 6 to 3 has depth of 1 and 6 to 2 has depth of 2. Do that for the rest of the nodes and sum them up then divide by the total number of nodes and that is the average depth. So it's (1 + 1 + 2 + 2 + 2 + 3)/7. Can anyone else verify if this is correct.

Topic archived. No new replies allowed.