Let us create Binary Tree shown in above example
root = newNode ( 8 ) NEW_LINE root . left = newNode ( 3 ) NEW_LINE root . left . left = newNode ( 1 ) NEW_LINE root . left . right = newNode ( 6 ) NEW_LINE root . left . right . left = newNode ( 4 ) NEW_LINE root . left . right . right = newNode ( 7 ) NEW_LINE root . right = newNode ( 10 ) NEW_LINE root . right . right = newNode ( 14 ) NEW_LINE root . right . right . left = newNode ( 13 ) NEW_LINE print ( " Maximum ▁ difference ▁ between ▁ a ▁ node ▁ and " , " its ▁ ancestor ▁ is ▁ : " , maxDiff ( root ) ) NEW_LINE