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)
| 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 |
no outgoing calls