full binary tree != 滿二叉樹

來源:互聯網
上載者:User

 國內教材對滿二叉樹的定義:

一棵深度為k且有2^k-1個結點的二叉樹稱為滿二叉樹. ————嚴蔚敏《資料結構(C語言版)》124頁

即達到飽和的二叉樹。也可以這麼定義:

同時滿足下面兩個條件的二叉樹稱為滿二叉樹:

(1)每個結點要麼有兩個子結點,要麼沒有子結點;

(2)葉子結點只能出現在最後一層。

是一棵符合國內教材定義的滿二叉樹:

國際上對full binary tree的定義:

A binary tree in which each node has exactly zero or two children.In other words, every node is either a leaf or has two children. For efficiency, any Huffman coding is a full binary tree.

 ———— NIST: http://xlinux.nist.gov/dads/HTML/fullBinaryTree.html

用中文描述一下,也可以這樣定義:

滿足下面這個條件的二叉樹稱為滿二叉樹:

每個結點要麼有兩個子結點,要麼沒有子結點。

是一棵符合NIST定義的滿二叉樹:

可見,國際上對full binary tree的定義比國內教材對滿二叉樹的定義放寬了要求,不要求所有葉子幾點必須在最後一層出現。

國內教材定義的滿二叉樹這類樹,NIST也有相應的定義,稱為perfect binary tree

A binary tree with all leaf nodes at the same depth. All internal nodes have degree 2. 

————NIST: http://xlinux.nist.gov/dads/HTML/perfectBinaryTree.html

國內教材定義的完全二叉樹和國際定義的complete binary tree相符:

A binary tree in which every level, except possibly the deepest, is completely filled. At depth n, the height of the tree, all nodes must be as far left as possible. 

————http://xlinux.nist.gov/dads/HTML/completeBinaryTree.html

是一棵完全二叉樹:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.