MCPcopy Create free account
hub / github.com/TheAlgorithms/JavaScript / search

Method search

Data-Structures/Tree/BinarySearchTree.js:128–138  ·  view source on GitHub ↗
(val)

Source from the content-addressed store, hash-verified

126
127 // Start by searching the root
128 search(val) {
129 if (this.root) {
130 const found = this.root.search(val)
131 if (found !== null) {
132 return found.value
133 }
134 }
135
136 // not found
137 return null
138 }
139
140 // Add a new value to the tree
141 addValue(val) {

Callers

nothing calls this directly

Calls 1

searchMethod · 0.45

Tested by

no test coverage detected