Home > Net >  Why is a complete binary tree most suited for heap implementation?
Why is a complete binary tree most suited for heap implementation?

Time:05-23

I could not figure out why complete binary tree is most suited for mplementing heap? why we cannot use full binary tree? WHy complete binary tree is the most suited for heap implementation?

CodePudding user response:

Full binary trees for heaps?

A full binary tree is not necessarily well-balanced. For instance, this is a full binary tree:

             1
            / \
           2   3
          / \
         4   5
        / \
       6   7
      / \
     8   9
    / \
  10   11

In general, a full binary tree where any right child is also a leaf, has a height that is O(

  • Related