check if a tree is a binary search tree

前端 未结 9 896
遥遥无期
遥遥无期 2021-01-30 09:29

I have written the following code to check if a tree is a Binary search tree. Please help me check the code:

Okay! The code is edited now. This simple solution was sugge

9条回答
  •  离开以前
    2021-01-30 10:07

    It doesn't really make much sense to return INTEGER.MIN,INTEGER.MAX as the values for an empty tree. Perhaps use an Integer and return null instead.

提交回复
热议问题