Depth of BSTree node ( java ) [closed]
I stuck in depth of BSTree node
does anyone have algorithm or code for finding the depth of BSTree node??? thanksPsuedocode:
Function Depth
If the right child isn't null, set left_depth to Depth(left_child), else set left_depth to 0.
If the left child isn't null,set right_depth to Depth(right_child), else set right_depth to 0.
return maximum(left_depth, right_depth) + 1;
See this posted code.
精彩评论