MCPcopy Index your code
hub / github.com/OmkarPathak/pygorithm / search

Method search

pygorithm/data_structures/trie.py:42–50  ·  view source on GitHub ↗

Searches for given word in trie. We want to find the last node for the word. If we can't, then it means the word is not in the trie.

(self, word)

Source from the content-addressed store, hash-verified

40 curr = curr.children[c]
41
42 def search(self, word):
43 """
44 Searches for given word in trie. We want to find the last node for the
45 word. If we can't, then it means the word is not in the trie.
46 """
47 if self.find_final_node(word):
48 return True
49 else:
50 return False
51
52 def find_words(self, prefix):
53 """

Callers 8

test_stackMethod · 0.95
test_linear_searchMethod · 0.80
test_binary_searchMethod · 0.80
test_bfsMethod · 0.80
test_dfsMethod · 0.80
test_ternary_searchMethod · 0.80

Calls 1

find_final_nodeMethod · 0.95

Tested by 8

test_stackMethod · 0.76
test_linear_searchMethod · 0.64
test_binary_searchMethod · 0.64
test_bfsMethod · 0.64
test_dfsMethod · 0.64
test_ternary_searchMethod · 0.64