mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
79acf78b2a
* refactor(data-structures): remove `private` use * tweaks * work * fix * Fix Co-authored-by: lucacasonato <hello@lcas.dev> --------- Co-authored-by: lucacasonato <hello@lcas.dev>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. 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<T>(tree: BinarySearchTree<T>): BinarySearchNode<T> | null;
|
|
/** Sets the root node of the binary search tree. */
|
|
setRoot<T>(
|
|
tree: BinarySearchTree<T>,
|
|
node: BinarySearchNode<T> | null,
|
|
): void;
|
|
getCompare<T>(tree: BinarySearchTree<T>): (a: T, b: T) => number;
|
|
setCompare<T>(
|
|
tree: BinarySearchTree<T>,
|
|
compare: (a: T, b: T) => number,
|
|
): void;
|
|
findNode<T>(
|
|
tree: BinarySearchTree<T>,
|
|
value: T,
|
|
): BinarySearchNode<T> | null;
|
|
rotateNode<T>(
|
|
tree: BinarySearchTree<T>,
|
|
node: BinarySearchNode<T>,
|
|
direction: Direction,
|
|
): void;
|
|
insertNode<T>(
|
|
tree: BinarySearchTree<T>,
|
|
Node: typeof BinarySearchNode,
|
|
value: T,
|
|
): BinarySearchNode<T> | null;
|
|
removeNode<T>(
|
|
tree: BinarySearchTree<T>,
|
|
node: BinarySearchNode<T>,
|
|
): BinarySearchNode<T> | null;
|
|
} = {} as typeof internals;
|