Driver program to run the case
public static void main ( String args [ ] ) { Node root = newnode ( 9 ) ; root . left = newnode ( 4 ) ; root . right = newnode ( 17 ) ; root . left . left = newnode ( 3 ) ; root . left . right = newnode ( 6 ) ; root . left . right . left = newnode ( 5 ) ; root . left . right . right = newnode ( 7 ) ; root . right . right = newnode ( 22 ) ; root . right . right . left = newnode ( 20 ) ; int k = 18 ; System . out . println ( maxDiff ( root , k ) ) ; } }