Let us create binary tree given in the above example
root = newNode ( 10 ) NEW_LINE root . left = newNode ( 2 ) NEW_LINE root . right = newNode ( 6 ) NEW_LINE root . right . right = newNode ( 5 ) NEW_LINE root . left . left = newNode ( 8 ) NEW_LINE root . left . right = newNode ( 4 ) NEW_LINE test ( root , 10 ) NEW_LINE test ( root , 2 ) NEW_LINE test ( root , 6 ) NEW_LINE test ( root , 5 ) NEW_LINE test ( root , 8 ) NEW_LINE test ( root , 4 ) NEW_LINE