Binary tree utilities

Height of binary tee

Longest path from the root the leaves.

/**
     * Find the height of the binary tree given the root node.
     * @param root
     * @return Height of the longest path.
     */
    protected int computeHeight(Node root){
        if(null 
read the rest.
Binary tree utilities

Binary tree

Notes on Binary Tree

  • Tree with max 2 children in each node.
  • The maximum number of nodes at level ‘l’ of a binary tree is 2^(l-1). Level of root is 1.
  • Maximum number of nodes in a binary tree of
read the rest.
Binary tree