MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / insert_many

Method insert_many

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

Insert many words in the tree Args: words (list[str]): list of words >>> RadixNode("myprefix").insert_many(["mystring", "hello"])

(self, words: list[str])

Source from the content-addressed store, hash-verified

37 return self.prefix[:x], self.prefix[x:], word[x:]
38
39 def insert_many(self, words: list[str]) -> None:
40 """Insert many words in the tree
41
42 Args:
43 words (list[str]): list of words
44
45 >>> RadixNode("myprefix").insert_many(["mystring", "hello"])
46 """
47 for word in words:
48 self.insert(word)
49
50 def insert(self, word: str) -> None:
51 """Insert a word into the tree

Callers 2

test_trieFunction · 0.95
mainFunction · 0.95

Calls 1

insertMethod · 0.95

Tested by 1

test_trieFunction · 0.76