March 2019
Intermediate to advanced
336 pages
9h 9m
English
The SearchNode method searches the specified node in the binary search tree. First, the RLock method of the tree lock instance is called. Then, the RUnlock method on the tree lock instance is deferred. The SearchNode method of the BinarySearchTree class invokes the searchNode method with the rootNode and the key integer value as parameters, as shown here:
// SearchNode methodfunc (tree *BinarySearchTree) SearchNode(key int) bool { tree.lock.RLock() defer tree.lock.RUnlock() return searchNode(tree.rootNode, key)}
Read now
Unlock full access