Introduction

Reference:

  1. 演算法筆記:Binary Tree
  2. Full v.s. Complete Binary Trees

Types of binary trees:

  1. full binary tree
  2. complete binary tree
  3. perfect binary tree

1. full binary tree:

A full binary tree (sometimes proper binary tree or 2-tree) is a tree in which every node other than the leaves has two children.

     0
    / \
   1   2
  / \
 3   4

2. complete binary tree:

A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.

       0
    /     \
   1       2
  / \     / \
 3   4   5

3. perfect binary tree:

A complete binary tree is a full binary tree, and it is also a complete binary tree.

       0
    /     \
   1       2
  / \     / \
 3   4   5   6  

results matching ""

    No results matching ""