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)
| 76 | |
| 77 | |
| 78 | def print_words(node: TrieNode, word: str) -> None: |
| 79 | """ |
| 80 | Prints all the words in a Trie |
| 81 | :param node: root node of Trie |
| 82 | :param word: Word variable should be empty at start |
| 83 | :return: None |
| 84 | """ |
| 85 | if node.is_leaf: |
| 86 | print(word, end=" ") |
| 87 | |
| 88 | for key, value in node.nodes.items(): |
| 89 | print_words(value, word + key) |
| 90 | |
| 91 | |
| 92 | def test_trie() -> bool: |
nothing calls this directly
no outgoing calls
no test coverage detected