MCPcopy Index your code
hub / github.com/nodejs/node / findGreatestLessThan

Method findGreatestLessThan

deps/v8/tools/splaytree.mjs:158–172  ·  view source on GitHub ↗

* @return {SplayTreeNode} Node having the maximum key value that * is less or equal to the specified key value.

(key)

Source from the content-addressed store, hash-verified

156 * is less or equal to the specified key value.
157 */
158 findGreatestLessThan(key) {
159 if (this.isEmpty()) return null;
160 // Splay on the key to move the node with the given key or the last
161 // node on the search path to the top of the tree.
162 this.splay_(key);
163 // Now the result is either the root node or the greatest node in
164 // the left subtree.
165 if (this.root_.key <= key) {
166 return this.root_;
167 } else if (this.root_.left !== null) {
168 return this.findMax(this.root_.left);
169 } else {
170 return null;
171 }
172 }
173
174 /**
175 * @return {Array<*>} An array containing all the values of tree's nodes paired

Callers 3

findInTree_Method · 0.80
splaytree.mjsFile · 0.80

Calls 3

isEmptyMethod · 0.95
splay_Method · 0.95
findMaxMethod · 0.95

Tested by

no test coverage detected