最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。
There is no subscript in the binary search tree, so for the search operation of the binary search tree, a contain method is defined to determine whether the binary search tree contains an element and returns a Boolean variable. The search operation is also a recursive process. The specific code is as follows:
... // 查看以node为根的二分搜索树中是否包含键值为key的节点, 使用递归算法 private boolean contain(Node node, Key key){ if( node == null ) return false; if( key.compareTo(node.key) == 0 ) return true; else if( key.compareTo(node.key) < 0 ) return contain( node.left , key ); else // key > node->key return contain( node.right , key ); } ... The following example looks for 43 elements in the binary search tree

(1) Element 43 is larger than root node 42 and needs to be compared at the right child node.

(2) Element 43 is smaller than 59 and needs to be compared in the left child node.

(3) Element 43 is smaller than 51 and needs to be compared in the left child node.

(4) Look for the left child node 43 of 51, which is exactly equal to the end.
If you need to find the value for key, the code is as follows:
... // 在以node为根的二分搜索树中查找key所对应的value, 递归算法 // 若value不存在, 则返回NULL private Value search(Node node, Key key){ if( node == null ) return null; if( key.compareTo(node.key) == 0 ) return node.value; else if( key.compareTo(node.key) < 0 ) return search( node.left , key ); else // key > node->key return search( node.right, key ); } ... 5.17.1. Java instance code ¶
源码包下载: Download Src/runoob/binary/BinarySearchTreeSearch.java file code: ¶
package runoob.binary; /*\* \* 二分搜索树查找 */ public class BinarySearchTreeSearch