MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / insert

Method insert

Python/Trie.py:12–18  ·  view source on GitHub ↗
(self, word)

Source from the content-addressed store, hash-verified

10 self.root = TrieNode()
11
12 def insert(self, word):
13 node=self.root
14 for i in word:
15 if i not in node.children:
16 node.children[i]=TrieNode()
17 node=node.children[i]
18 node.word=True
19
20 def search(self, word):
21 node=self.root

Callers 2

escape_routeFunction · 0.45
_clearstampMethod · 0.45

Calls 1

TrieNodeClass · 0.70

Tested by

no test coverage detected