MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / search

Method search

data_structures/suffix_tree/suffix_tree.py:51–66  ·  view source on GitHub ↗

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.

(self, pattern: str)

Source from the content-addressed store, hash-verified

49 node.end = index + len(suffix) - 1
50
51 def search(self, pattern: str) -> bool:
52 """
53 Searches for a pattern in the suffix tree.
54
55 Args:
56 pattern (str): The pattern to search for.
57
58 Returns:
59 bool: True if the pattern is found, False otherwise.
60 """
61 node = self.root
62 for char in pattern:
63 if char not in node.children:
64 return False
65 node = node.children[char]
66 return True

Callers 6

mainFunction · 0.95
test_search_full_textMethod · 0.45

Calls

no outgoing calls