acompare current val with previous one in binary tree inorder traversal