What do you mean when you refer the depth of the node around 3:59, For me the depth means, The depth of a node in a binary tree refers to the number of edges in the path from the root node of the tree to that specific node. In other words, it represents how far down the node is from the root,, can you please elaborate that dept part.
@@nikoo28 Ok thanks. but then how is the depth of leaf nodes 2, 1, 6, 0, 1 is 1 and then similarly for 7, 5 is 2 I am little lost there. Or may be I am understanding here incorrectly. Pls explain .
I see your confusion...actually, depth of a node relative to tree, and depth of a need relative to a node are different. In this particular problem, our frame of reference is the parent node to leaf nodes. unfortunately, there is not generic definition for depth of a node.
DFS and BFS are literally the same...one uses a stack, other uses a queue. Watch my videos on BFS and DFS...and this concept will be clear for the rest of your life :)
actually depth word used explanation is misleading , it's actually maximum level the node is from leaf default starts with one , depth is the number of edges from leaf node to root