# Class Trie

#### Hierarchy

- Trie

- Defined in src/data-structures/trie/trie.ts:46

#####
Index

### Constructors

constructor

### Properties

_root

### Accessors

root

### Methods

add
getAll
getLongestCommonPrefix
has
isAbsPrefix
isCommonPrefix
isPrefix
remove

## Constructors

### constructor

- new Trie(words?): Trie

- #### Parameters

  - ##### `Optional` words: string[]

  #### Returns Trie

  - Defined in src/data-structures/trie/trie.ts:47

## Properties

### `Protected` _root

_root: TrieNode

- Defined in src/data-structures/trie/trie.ts:56

## Accessors

### root

- get root(): TrieNode

- #### Returns TrieNode

  - Defined in src/data-structures/trie/trie.ts:58
- set root(v): void

- #### Parameters

  - ##### v: TrieNode

  #### Returns void

  - Defined in src/data-structures/trie/trie.ts:62

## Methods

### add

- add(word): boolean

- #### Parameters

  - ##### word: string

  #### Returns boolean

  - Defined in src/data-structures/trie/trie.ts:66

### getAll

- getAll(prefix?): string[]

- 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.

  - Defined in src/data-structures/trie/trie.ts:196

### getLongestCommonPrefix

- getLongestCommonPrefix(): string

- 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.

  - Defined in src/data-structures/trie/trie.ts:178

### has

- has(input): boolean

- #### Parameters

  - ##### input: string

  #### Returns boolean

  - Defined in src/data-structures/trie/trie.ts:80

### isAbsPrefix

- isAbsPrefix(input): boolean

- 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.

  - Defined in src/data-structures/trie/trie.ts:128

### isCommonPrefix

- isCommonPrefix(input): boolean

- 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.

  - Defined in src/data-structures/trie/trie.ts:159

### isPrefix

- isPrefix(input): boolean

- 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.

  - Defined in src/data-structures/trie/trie.ts:143

### remove

- remove(word): boolean

- #### Parameters

  - ##### word: string

  #### Returns boolean

  - Defined in src/data-structures/trie/trie.ts:90

Generated using TypeDoc