Function to traverse a binary encoded path and return the value encountered after traversal .
public static int traversePath ( Node root , ArrayList < Integer > path ) { for ( int i = 0 ; i < path . size ( ) ; i ++ ) { int direction = path . get ( i ) ;