In the Huffman tree with degrees m, the number of leaf nodes is n, then the number of non-leaf nodes is ().

Source: Internet
Author: User
Let's start by stating that we usually say Huffman tree is the best binary tree, also known as strict binary tree (note is not a complete binary tree), but Huffman Tree is not limited to binary tree, also exist in the multi-fork tree, that is, the degree of M Huffman Tree, also known as the optimal m fork tree, strict m fork tree (note is not a complete M-fork tree).
This question indicates that the number of nodes of Huffman tree is either 0 or M setting is not 0 (that is, non-leaf node) is X
The total node count is: X+n
Root nodes, each of the remaining nodes has a branch connected to a node, and there are m branches for each node with degrees m, and the nodes with degrees 0 are not branched, so from the point of view of the branch
Total number of nodes: X*m + 1 (here the 1 is the root node)
The two are equal, so the answer is (n-1)/(M-1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.