<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 滿二叉樹 ### 定義 每個節點都有左右孩子 ### 判斷滿二叉樹 節點個數 = 2 ^ 數最大高度 - 1 ~~~ /** * 判斷滿二叉樹:節點個數 = 2^最大深度 - 1 * @Author: mango * @Date: 2022/4/14 10:00 下午 */ public class FullTree { public boolean isFullTree(TreeNode root) { FullInfo info = process(root); return info.nodeCount == Math.pow(2,info.height) - 1; } public FullInfo process(TreeNode node){ if(node == null){ return new FullInfo(0,0); } FullInfo left = process(node.left); FullInfo right = process(node.right); // 高度 = 左樹或者右樹較高的高度 + 當前節點高度1 int height = Math.max(left.height,right.height) + 1; // 節點數 = 左樹節點數 + 右樹節點數 + 當前節點1 int nodeCount = left.nodeCount + right.nodeCount + 1; return new FullInfo(height,nodeCount); } } class FullInfo{ public int height; public int nodeCount; public FullInfo(int height, int nodeCount) { this.height = height; this.nodeCount = nodeCount; } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看