leetcode:二叉樹層序遍歷(C實現,遞歸與非遞歸)

1.遞歸法node int depth(struct TreeNode *root) { int ld=0,rd=0; if(root) { ld=depth(root->left)+1; rd=depth(root->right)+1; } return ld>=rd?ld:rd; } void level_order_re
相關文章
相關標籤/搜索