Class Trie

Class representing a Trie (Prefix Tree) data structure. Provides efficient insert, search, delete, and prefix search functionalities.

Constructors

Methods

  • Deletes a word from the Trie.

    Parameters

    • word: string

      The word to delete.

    Returns boolean

    True if the word was successfully deleted, false if the word was not found.

  • Searches for a word in the Trie.

    Parameters

    • word: string

      The word to search for.

    Returns boolean

    True if the word exists in the Trie, false otherwise.

  • Checks if there is any word in the Trie that starts with the given prefix.

    Parameters

    • prefix: string

      The prefix to search for.

    Returns boolean

    True if there is any word with the prefix, false otherwise.