// Copyright 2018-2026 the Deno authors. MIT license. // This module is browser compatible. import type { BinarySearchNode } from "./_binary_search_node.ts"; import type { Direction } from "./_red_black_node.ts"; import type { BinarySearchTree } from "./binary_search_tree.ts"; // These are the private methods and properties that are shared between the // binary search tree and red-black tree implementations. They are not meant // to be used outside of the data structures module. export const internals: { /** Returns the root node of the binary search tree. */ getRoot(tree: BinarySearchTree): BinarySearchNode | null; /** Sets the root node of the binary search tree. */ setRoot( tree: BinarySearchTree, node: BinarySearchNode | null, ): void; getCompare(tree: BinarySearchTree): (a: T, b: T) => number; setCompare( tree: BinarySearchTree, compare: (a: T, b: T) => number, ): void; findNode( tree: BinarySearchTree, value: T, ): BinarySearchNode | null; rotateNode( tree: BinarySearchTree, node: BinarySearchNode, direction: Direction, ): void; insertNode( tree: BinarySearchTree, Node: typeof BinarySearchNode, value: T, ): BinarySearchNode | null; removeNode( tree: BinarySearchTree, node: BinarySearchNode, ): BinarySearchNode | null; setSize(tree: BinarySearchTree, size: number): void; } = {} as typeof internals;