Binary Tree

  1. full binary tree

every node other than the leaves has2 children

  1. perfect binary tree

all leaves are at the same depth, every parent has 2 children

  1. complete

every level except possibly the last, is completely filled and all nodes are as far left as possible.

Sample Implementation

class Node(object):
    def __init__(self, val):
        self.left = None
        self.right = None
        self.val = val

class Tree(object):