# Trie | data-structure-typed
Documentation for data-structure-typed

# Class Trie

#### Hierarchy

- Trie

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

#####
Index

### Constructors

constructor

### Properties

_root

### Accessors

root

### Methods

getAll
getLongestCommonPrefix
has
isAbsPrefix
isCommonPrefix
isPrefix
put
remove

## Constructors

### constructor

- new Trie(words?): Trie

- #### Parameters

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

  #### Returns Trie

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

## Properties

### `Protected` _root

_root: TrieNode

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

## Accessors

### root

- get root(): TrieNode

- #### Returns TrieNode

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

- #### Parameters

  - ##### v: TrieNode

  #### Returns void

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

## Methods

### 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:193

### 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:175

### has

- has(input): boolean

- #### Parameters

  - ##### input: string

  #### Returns boolean

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

### 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:125

### 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:156

### 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:140

### put

- put(word): boolean

- #### Parameters

  - ##### word: string

  #### Returns boolean

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

### remove

- remove(word): boolean

- #### Parameters

  - ##### word: string

  #### Returns boolean

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

Generated using TypeDoc