擅长:python、mysql、java
<p>应采用以下方法:</p>
<pre><code>class Node:
def is_binary_search(self, lo=None, hi=None):
if lo is not None and lo > self.data:
return False
if hi is not None and hi < self.data:
return False
if self.left and not self.left.is_binary_search(lo=lo, hi=self.data):
return False
if self.right and not self.right.is_binary_search(lo=self.data, hi=hi):
return False
return True
</code></pre>
<p>在递归调用中传递那些已知的子树边界(<code>lo</code>和<code>hi</code>)</p>