Return the total number of leaf nodes in the binary tree. A leaf node is a node with no child nodes. :return: Total number of leaf nodes. :rtype: int **Example**: .. doctest:: >>> from binarytree import Node >>> >>> roo
(self)
| 1073 | |
| 1074 | @property |
| 1075 | def leaf_count(self) -> int: |
| 1076 | """Return the total number of leaf nodes in the binary tree. |
| 1077 | |
| 1078 | A leaf node is a node with no child nodes. |
| 1079 | |
| 1080 | :return: Total number of leaf nodes. |
| 1081 | :rtype: int |
| 1082 | |
| 1083 | **Example**: |
| 1084 | |
| 1085 | .. doctest:: |
| 1086 | |
| 1087 | >>> from binarytree import Node |
| 1088 | >>> |
| 1089 | >>> root = Node(1) |
| 1090 | >>> root.left = Node(2) |
| 1091 | >>> root.right = Node(3) |
| 1092 | >>> root.left.right = Node(4) |
| 1093 | >>> |
| 1094 | >>> root.leaf_count |
| 1095 | 2 |
| 1096 | """ |
| 1097 | return _get_tree_properties(self).leaf_count |
| 1098 | |
| 1099 | @property |
| 1100 | def is_balanced(self) -> bool: |
nothing calls this directly
no test coverage detected