March 2019
Intermediate to advanced
336 pages
9h 9m
English
The inOrderTraverse method visits all nodes in order. The RLock() method on the tree lock instance is called first. The RUnLock() method is deferred on the tree lock instance before invoking the inOrderTraverseTree method, as presented in the following code snippet:
// InOrderTraverseTree methodfunc (tree *BinarySearchTree) InOrderTraverseTree(function func(int)) { tree.lock.RLock() defer tree.lock.RUnlock() inOrderTraverseTree(tree.rootNode, function)}
Read now
Unlock full access