@types/bintrees
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Installation

npm install --save @types/bintrees

Summary

This package contains type definitions for bintrees (https://github.com/vadimg/js_bintrees).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bintrees.

index.d.ts

declare module "bintrees" {
    type Callback<T> = (item: T) => void;
    type Comparator<T> = (a: T, b: T) => number;

    class Iterator<T> {
        constructor(tree: TreeBase<T>);

        data(): T | null;

        next(): T | null;

        prev(): T | null;
    }

    class TreeBase<T> {
        size: number;

        clear(): void;

        find(data: T): T | null;

        findIter(data: T): Iterator<T> | null;

        lowerBound(item: T): Iterator<T>;

        upperBound(item: T): Iterator<T>;

        min(): T | null;

        max(): T | null;

        iterator(): Iterator<T>;

        each(cb: Callback<T>): void;

        reach(cb: Callback<T>): void;
    }

    export class RBTree<T> extends TreeBase<T> {
        constructor(comparator: Comparator<T>);

        insert(item: T): boolean;

        remove(item: T): boolean;
    }

    export class BinTree<T> extends TreeBase<T> {
        constructor(comparator: Comparator<T>);

        insert(item: T): boolean;

        remove(item: T): boolean;
    }
}

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:04 GMT
  • Dependencies: none

Credits

These definitions were written by Cayle Sharrock.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/bintrees

Weekly Downloads

42,417

Version

1.0.6

License

MIT

Unpacked Size

4.58 kB

Total Files

5

Last publish

Collaborators

  • types