MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / find

Method find

data_structures/trie/trie.py:37–48  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

35 curr.is_leaf = True
36
37 def find(self, word: str) -> bool: # noqa: E999 This syntax is Python 3 only
38 """
39 Tries to find word in a Trie
40 :param word: word to look for
41 :return: Returns True if word is found, False otherwise
42 """
43 curr = self
44 for char in word:
45 if char not in curr.nodes:
46 return False
47 curr = curr.nodes[char]
48 return curr.is_leaf
49
50
51def print_words(node: TrieNode, word: str): # noqa: E999 This syntax is Python 3 only

Callers 6

testFunction · 0.95
translateMessageFunction · 0.80
translateMessageFunction · 0.80
encryptMessageFunction · 0.80
decryptMessageFunction · 0.80
decryptFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected