MCPcopy Create free account
hub / github.com/denoland/std / #findNode

Method #findNode

data_structures/binary_search_tree.ts:322–331  ·  view source on GitHub ↗
(value: T)

Source from the content-addressed store, hash-verified

320 }
321
322 #findNode(value: T): BinarySearchNode<T> | null {
323 let node: BinarySearchNode<T> | null = this.#root;
324 while (node) {
325 const order: number = this.#compare(value as T, node.value);
326 if (order === 0) break;
327 const direction: "left" | "right" = order < 0 ? "left" : "right";
328 node = node[direction];
329 }
330 return node;
331 }
332
333 #rotateNode(node: BinarySearchNode<T>, direction: Direction) {
334 const replacementDirection: Direction = direction === "left"

Callers 3

removeMethod · 0.95
findMethod · 0.95
BinarySearchTreeClass · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected