Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

What is exactly the definition of a complete binary tree?

  1. May 6, 2005 #1


    User Avatar

    Hi Ho! ^_^

    Actually, what is the definition of a complete binary tree?
    I have searched the Internet and come up with several definition. This problem is confusing enough.

    According to http://planetmath.org/encyclopedia/CompleteBinaryTree.html,
    "A complete binary tree is a binary tree with the additional property that every node must have exactly two children if an internal node, and zero children if a leaf node."

    Moreover, in http://www.nist.gov/dads/HTML/completeBinaryTree.html,
    "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."

    Furthermore, my lecture note says,
    "A Complete Binary Tree is a Binary Tree with leaves on either a single level or on two adjacent levels such that the leaves on the bottommost level are placed as far left as possible"

    Well, I don't know where I can find the right definition of a complete binary tree. Could you please help me?

    Any help would be appreciated ^^
    Thank you very much! ^^v
  2. jcsd
  3. May 6, 2005 #2


    User Avatar
    Gold Member

    I didn't know what a binary tree was until I saw this post, but I looked through some books on Amazon, and even they give (substantially) different definitions. I also checked several sites, and there is most agreement on:
    1) All nodes of the deepest level being as far left as possible.
    2) All levels except possibly the deepest being completely filled (having the maximum number of nodes).
    What isn't clear is whether every internal node must have exactly two branches (or children).
    I found this theorem elsewhere. Of course, I also found a problem:
    I also found this elsewhere. The point of finding them was that 1) if every internal node must have exactly two branches, then the total number of nodes would always be odd (perhaps with the empty node or node that's just the root as exceptions). So if the total number of nodes can be even, then the internal nodes (on the second deepest level) don't need to have exactly two branches. 2) To show why I think the "right" definition is whichever definition you use. 3) Eh, it was interesting to learn about.
    Maybe there's more consensus then there seems to be and someone who knows the subject better can let you know what it is. But if no one else replies, I would go with the definition that best suits your problem or try to find out from your book, problem, or teacher if you're expected to use a certain definition. Good luck.
  4. May 6, 2005 #3
    a complete binary tree is complete on all levels except maybe the last in which case the nodes must be to the left...always go to mathworld.com to check for definitions. That is to say that its filled up on everylevel.
    NOTE in mathematics that is the worst definition possible but in lamens its teh easiest explanation to understand

    x x
    x x x x
    x x x x

    the last 2 definitions imply this though through strange wording
    The Lecture Notes: what its saying is that the leaves can be on the 2nd lowest level
    but all the leaves on the bottom must be towards the left as the diagram above.
    Really weird wording
    the Nist def'n" is basically waht I said with math terms.

    The Planet def'n i belivee is wrong
  5. May 9, 2005 #4


    User Avatar
    Science Advisor
    Homework Helper

    If you go to the NIST website and look up "full binary tree" you'll get the definition given by PlanteMath for "complete binary tree." As far as I know, there is indeed some ambiguity here. It is possible to see in texts "full" and "complete" using the definition that is given to the other term by NIST. It is also possible to see a source defining "complete" as NIST defines "full" (as in the previous case) but does not define "full" at all (not as in the previous case), as does PlanetMath.
  6. May 9, 2005 #5


    User Avatar

    Thank you very much for the information, guys! ^_^

    Hi Ho! ^_^

    Thank you very much for your precious information, guys! ^_^
    I really appreciate them! ^^v

    See you later, guys! ^_^
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: What is exactly the definition of a complete binary tree?
  1. What exactly is infinite (Replies: 32)

  2. What is ∞ exactly? (Replies: 10)