A Trie is a tree for efficient storing and retrieval of strings such as words in a dictionary. They are useful for checking all the strings that have a common prefix. Insertions, lookups and removals in O(s) where s is the search term.

See

Trie

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

Properties

matches: ((word: string, limit??: number) => Generator<any, void, any>) = ...

Type declaration

    • (word: string, limit??: number): Generator<any, void, any>
    • Generates all results that start with the given string.

      Parameters

      • word: string

        A prefix string

      • Optional limit: number = 20

        The number of results to return.

      Returns Generator<any, void, any>

Accessors

  • get size(): number
  • Returns the total number of strings in the tree.

    Returns number

Methods

  • Removes the given string from the tree.

    Returns

    Returns true if the string was found and removed.

    Parameters

    • word: string

      The string to remove

    Returns boolean

Generated using TypeDoc