Hierarchy

  • Trie

Constructors

Properties

_root: TrieNode

Accessors

Methods

  • The getAll function returns an array of all words in a Trie data structure that start with a given prefix.

    Parameters

    • Optional prefix: string = ''

      The prefix parameter is a string that represents the prefix that we want to search for in the trie. It is an optional parameter, so if no prefix is provided, it will default to an empty string.

    Returns string[]

    an array of strings.

  • The function getLongestCommonPrefix returns the longest common prefix among all the words stored in a Trie data structure.

    Returns string

    The function getLongestCommonPrefix returns a string, which is the longest common prefix found in the Trie.

  • The function checks if a given input string has an absolute prefix in a tree data structure.Only can present as a prefix, not a word

    Parameters

    • input: string

      The input parameter is a string that represents the input value for the function.

    Returns boolean

    a boolean value.

  • The function checks if the input string is a common prefix in a Trie data structure.Check if the input string is the common prefix of all the words

    Parameters

    • input: string

      The input parameter is a string that represents the common prefix that we want to check for in the Trie data structure.

    Returns boolean

    a boolean value indicating whether the input string is a common prefix in the Trie data structure.

  • The function checks if a given input string is a prefix of any existing string in a tree structure.Can present as a abs prefix or word

    Parameters

    • input: string

      The input parameter is a string that represents the prefix we want to check.

    Returns boolean

    a boolean value.

Generated using TypeDoc