March 2019
Intermediate to advanced
336 pages
9h 9m
English
The PreOrderTraverseTree method visits all the tree nodes with preorder traversing. The tree lock instance is locked first and the Unlock method is deferred before preOrderTraverseTree is called. In the following code snippet, the preOrderTraverseTree method is passed with rootNode and function as parameters:
// PreOrderTraverseTree methodfunc (tree *BinarySearchTree) PreOrderTraverseTree(function func(int)) { tree.lock.Lock() defer tree.lock.Unlock() preOrderTraverseTree(tree.rootNode, function)}
Read now
Unlock full access