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

Function print_words

data_structures/trie/trie.py:51–62  ·  view source on GitHub ↗

Prints all the words in a Trie :param node: root node of Trie :param word: Word variable should be empty at start :return: None

(node: TrieNode, word: str)

Source from the content-addressed store, hash-verified

49
50
51def print_words(node: TrieNode, word: str): # noqa: E999 This syntax is Python 3 only
52 """
53 Prints all the words in a Trie
54 :param node: root node of Trie
55 :param word: Word variable should be empty at start
56 :return: None
57 """
58 if node.is_leaf:
59 print(word, end=' ')
60
61 for key, value in node.nodes.items():
62 print_words(value, word + key)
63
64
65def test():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected