判斷一棵樹是否是平衡二叉樹

public int getDepth(TreeNode rootnode) { if (rootnode == null) return 0;//若是當前節點爲空返回深度爲0 int leftlength = getDepth(rootnode.left); int rigthlength = getDepth(rootnode.right);
相關文章
相關標籤/搜索