Print the tree Args: height (int, optional): Height of the printed node
(self, height: int = 0)
| 179 | return True |
| 180 | |
| 181 | def print_tree(self, height: int = 0) -> None: |
| 182 | """Print the tree |
| 183 | |
| 184 | Args: |
| 185 | height (int, optional): Height of the printed node |
| 186 | """ |
| 187 | if self.prefix != "": |
| 188 | print("-" * height, self.prefix, " (leaf)" if self.is_leaf else "") |
| 189 | |
| 190 | for value in self.nodes.values(): |
| 191 | value.print_tree(height + 1) |
| 192 | |
| 193 | |
| 194 | def test_trie() -> bool: |