>i dont know how to write the code ?
Do you know how to do a preorder traversal? Once you have that, it's just a test whether both children are either null or not null. It's a short solution, so I can't give you example code without solving the problem for you.
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Offline 11,807 posts
since Sep 2004