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

Method addValue

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

Source from the content-addressed store, hash-verified

139
140 // Add a new value to the tree
141 addValue(val) {
142 const n = new Node(val)
143 if (this.root === null) {
144 this.root = n
145 } else {
146 this.root.addNode(n)
147 }
148 }
149
150 // remove a value from the tree
151 removeValue(val) {

Callers 1

Calls 1

addNodeMethod · 0.45

Tested by

no test coverage detected