I have been doing some research on Binary trees and found that every other source gives different notion for depth and height of a node in Binary tree.
My notion
Height = Maximum length of path from a given node to the leaf node.
Depth = Number of edges from a given node to the root node.
/*
* 1 (1) level = 1, height = 3, depth = 0
* / \
* 2 3 (3) level = 2, height = 0, depth = 1
* / \
* 4 5 (5) level = 3, height = 1, depth = 2
* / \
* 6 7 (6, 7) level = 4, height = 0, depth = 3
*/
I have taken this notion from this blog post, but I am confused when there is just one node i.e. root its height is 1
.