Hierarchy

  • Trie

Constructors

Properties

root: TrieNode

Methods

  • Helper method to collect all words from a node

    Parameters

    • node: TrieNode
    • prefix: string
    • words: string[]

    Returns void

  • Deletes a word from the trie

    Parameters

    • word: string

    Returns boolean

  • Helper method to recursively delete a word

    Parameters

    • node: TrieNode
    • word: string
    • index: number

    Returns boolean

  • Finds the node corresponding to a prefix

    Parameters

    • prefix: string

    Returns null | TrieNode

  • Returns true if the word is in the trie

    Parameters

    • word: string

    Returns boolean

  • Returns true if there is any word in the trie that starts with the given prefix

    Parameters

    • prefix: string

    Returns boolean

  • Returns all words in the trie that start with the given prefix

    Parameters

    • prefix: string

    Returns string[]

Generated using TypeDoc