March 2019
Intermediate to advanced
336 pages
9h 9m
English
The InsertTreeNode method of the TreeSet class takes treeNodes variable arguments of the TreeNode type. In the following code, the elements with the key and value are inserted in the binary search tree of TreeSet:
// InsertTreeNode methodfunc (treeset *TreeSet) InsertTreeNode(treeNodes ...TreeNode) { var treeNode TreeNode for _, treeNode = range treeNodes { treeset.bst.InsertElement(treeNode.key, treeNode.value) }}
The example output of the InsertTreeNode method is as follows. The InsertTreeNode method takes treeNodes as the parameter. treeNodes are inserted with rootNode, which has a value of 8:

Read now
Unlock full access