MCPcopy Index your code
hub / github.com/0xAX/go-algorithms / Search

Method Search

binaryTree/binaryTree.go:19–32  ·  view source on GitHub ↗
(value interface{})

Source from the content-addressed store, hash-verified

17}
18
19func (tree *BinaryTree) Search(value interface{}) *BinaryTree {
20 if tree.node == nil {
21 return nil
22 }
23
24 if tree.node == value {
25 return tree
26 }
27 if tree.lessFun(value, tree.node) {
28 return tree.left.Search(value)
29 } else {
30 return tree.right.Search(value)
31 }
32}
33
34func (tree *BinaryTree) Insert(value interface{}) {
35 if tree.node == nil {

Callers 1

Test_binaryTreeFunction · 0.80

Calls

no outgoing calls

Tested by 1

Test_binaryTreeFunction · 0.64