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

Method #findNode

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

Source from the content-addressed store, hash-verified

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