If a tree has just one node i.e root node, then the height is 0, if there are 2 levels of nodes then height is 1 and so on. so the height or depth of a binary tree can be defined as the numbers of edges from the root node to its deepest node. For example in below figure the height or depth is 3.

Write a program to find depth of binary search tree without using recursionSample code based on iterative method to find height or depth of binary tree.



Related Contents to follow