MCPcopy Index your code
hub / github.com/joowani/binarytree / min_leaf_depth

Method min_leaf_depth

binarytree/__init__.py:1453–1484  ·  view source on GitHub ↗

Return the minimum leaf node depth of the binary tree. :return: Minimum leaf node depth. :rtype: int **Example**: .. doctest:: >>> from binarytree import Node >>> >>> root = Node(1) >>> root.left = Node(2)

(self)

Source from the content-addressed store, hash-verified

1451
1452 @property
1453 def min_leaf_depth(self) -> int:
1454 """Return the minimum leaf node depth of the binary tree.
1455
1456 :return: Minimum leaf node depth.
1457 :rtype: int
1458
1459 **Example**:
1460
1461 .. doctest::
1462
1463 >>> from binarytree import Node
1464 >>>
1465 >>> root = Node(1)
1466 >>> root.left = Node(2)
1467 >>> root.right = Node(3)
1468 >>> root.right.left = Node(4)
1469 >>> root.right.left.left = Node(5)
1470 >>>
1471 >>> print(root)
1472 <BLANKLINE>
1473 1____
1474 / \\
1475 2 3
1476 /
1477 4
1478 /
1479 5
1480 <BLANKLINE>
1481 >>> root.min_leaf_depth
1482 1
1483 """
1484 return _get_tree_properties(self).min_leaf_depth
1485
1486 @property
1487 def properties(self) -> Dict[str, Any]:

Callers

nothing calls this directly

Calls 1

_get_tree_propertiesFunction · 0.85

Tested by

no test coverage detected