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

Method print_tree

data_structures/trie/radix_tree.py:181–191  ·  view source on GitHub ↗

Print the tree Args: height (int, optional): Height of the printed node

(self, height: int = 0)

Source from the content-addressed store, hash-verified

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
194def test_trie() -> bool:

Callers 1

mainFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected