Recursive function to calculate the path length having maximum number of bends . The following are parameters for this function . node - . pointer to the current node dir - . determines whether the current node is left or right child of it 's parent node bends -. number of bends so far in the current path. maxBends -. maximum number of bends in a path from root to leaf soFar -. length of the current path so far traversed len -. length of the path having maximum number of bends
static int maxBends ; static int len ; static void findMaxBendsUtil ( Node node , char dir , int bends , int soFar ) {