Demonstrate the usage of the SuffixTree class. - Initializes a SuffixTree with a predefined text. - Defines a list of patterns to search for within the suffix tree. - Searches for each pattern in the suffix tree. Patterns tested: - "ana" (found) --> True - "ban
()
| 10 | |
| 11 | |
| 12 | def main() -> None: |
| 13 | """ |
| 14 | Demonstrate the usage of the SuffixTree class. |
| 15 | |
| 16 | - Initializes a SuffixTree with a predefined text. |
| 17 | - Defines a list of patterns to search for within the suffix tree. |
| 18 | - Searches for each pattern in the suffix tree. |
| 19 | |
| 20 | Patterns tested: |
| 21 | - "ana" (found) --> True |
| 22 | - "ban" (found) --> True |
| 23 | - "na" (found) --> True |
| 24 | - "xyz" (not found) --> False |
| 25 | - "mon" (found) --> True |
| 26 | """ |
| 27 | text = "monkey banana" |
| 28 | suffix_tree = SuffixTree(text) |
| 29 | |
| 30 | patterns = ["ana", "ban", "na", "xyz", "mon"] |
| 31 | for pattern in patterns: |
| 32 | found = suffix_tree.search(pattern) |
| 33 | print(f"Pattern '{pattern}' found: {found}") |
| 34 | |
| 35 | |
| 36 | if __name__ == "__main__": |
no test coverage detected