data_structures.suffix_tree.suffix_tree

Classes

SuffixTree

Module Contents

class data_structures.suffix_tree.suffix_tree.SuffixTree(text: str)
_add_suffix(suffix: str, index: int) None

Adds a suffix to the suffix tree.

Args:

suffix (str): The suffix to add. index (int): The starting index of the suffix in the original text.

build_suffix_tree() None

Builds the suffix tree for the given text by adding all suffixes.

search(pattern: str) bool

Searches for a pattern in the suffix tree.

Args:

pattern (str): The pattern to search for.

Returns:

bool: True if the pattern is found, False otherwise.

root: data_structures.suffix_tree.suffix_tree_node.SuffixTreeNode
text: str