Returns the depth of the tree >>> BinaryTree(Node(1)).depth() 1 >>> BinaryTree.small_tree().depth() 2 >>> BinaryTree.medium_tree().depth() 4
(self)
| 73 | return binary_tree |
| 74 | |
| 75 | def depth(self) -> int: |
| 76 | """ |
| 77 | Returns the depth of the tree |
| 78 | |
| 79 | >>> BinaryTree(Node(1)).depth() |
| 80 | 1 |
| 81 | >>> BinaryTree.small_tree().depth() |
| 82 | 2 |
| 83 | >>> BinaryTree.medium_tree().depth() |
| 84 | 4 |
| 85 | """ |
| 86 | return self._depth(self.root) |
| 87 | |
| 88 | def _depth(self, node: Node | None) -> int: |
| 89 | if not node: |