Tries to find word in a Trie :param word: word to look for :return: Returns True if word is found, False otherwise
(self, word: str)
| 34 | curr.is_leaf = True |
| 35 | |
| 36 | def find(self, word: str) -> bool: |
| 37 | """ |
| 38 | Tries to find word in a Trie |
| 39 | :param word: word to look for |
| 40 | :return: Returns True if word is found, False otherwise |
| 41 | """ |
| 42 | curr = self |
| 43 | for char in word: |
| 44 | if char not in curr.nodes: |
| 45 | return False |
| 46 | curr = curr.nodes[char] |
| 47 | return curr.is_leaf |
| 48 | |
| 49 | def delete(self, word: str) -> None: |
| 50 | """ |
no outgoing calls