### 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.

Skip to content
# Compute Patterns

## /* Scribbles on design patterns, architectural attributes, programming, best practices, AEM… */

#
Binary tree

# Binary tree utilities

### Height of binary tee

# Binary tree traversals (Java implementation)

# Binary tree

### Notes on Binary Tree

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.

Traversing binary tree. Since tree is a graph, both the depth first traversal and the breadth first traversal idea works.

- Depth first traversal – 3 classes. Time complexity – O(n) where n is number of nodes.
- InOrder traversal – Order

- 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