@@ -0,0 +1,903 @@
+package com.sunny.grokkingalgorithms.fasttrack.treesandgraphs;%0A%0Aimport com.sunny.grokkingalgorithms.ctci.c4.util.BinaryTreeNode;%0Aimport com.sunny.grokkingalgorithms.ctci.c4.util.TreeUtils;%0A%0A/**%0A * Created by sundas on 6/10/2018.%0A */%0Apublic class HeightOfABinaryTree %7B%0A%0A  /*%0A  Calculate height of a binary tree, number of edges from root to deepest leaf%0A   */%0A%0A  /**%0A   *%0A   * @param root%0A   * @return%0A   */%0A  public static int heightOf(BinaryTreeNode root)%7B%0A    if(root == null)%7B%0A      return 0;%0A    %7D%0A    int leftHeight = heightOf(root.left);%0A    int rightHeight = heightOf(root.right);%0A    return Math.max(leftHeight,rightHeight) + 1;%0A  %7D%0A%0A  /**%0A   *%0A   * @param args%0A   */%0A  public static void main(String%5B%5D args) %7B%0A    BinaryTreeNode root = TreeUtils.createBST();%0A    TreeUtils.performBfsLevelMarker(root);%0A    System.out.println(%22#################%22);%0A    System.out.println(heightOf(root));%0A  %7D%0A%0A%7D%0A

Find height of a tree, O(n).