开发者

Depth of BSTree node ( java ) [closed]

开发者 https://www.devze.com 2023-03-28 06:33 出处:网络
开发者_运维技巧 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
开发者_运维技巧 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I stuck in depth of BSTree node

does anyone have algorithm or code for finding the depth of BSTree node???

thanks


Psuedocode:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号