Node used by Trie to store one character and its children.

Time O(1), Space O(1)

Constructors

Accessors

Constructors

Accessors

  • get isEnd(): boolean
  • Check whether this node marks the end of a word.

    Returns boolean

    True if this node ends a word.

    Time O(1), Space O(1)

  • set isEnd(value): void
  • Mark this node as the end of a word or not.

    Parameters

    • value: boolean

      Whether this node ends a word.

    Returns void

    void

    Time O(1), Space O(1)

  • get key(): string
  • Get the character key of this node.

    Returns string

    Character key string.

    Time O(1), Space O(1)

  • set key(value): void
  • Set the character key of this node.

    Parameters

    • value: string

      New character key.

    Returns void

    void

    Time O(1), Space O(1)