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

Function _validate_tree_height

binarytree/__init__.py:1802–1810  ·  view source on GitHub ↗

Check if the height of the binary tree is valid. :param height: Height of the binary tree (must be 0 - 9 inclusive). :type height: int :raise binarytree.exceptions.TreeHeightError: If height is invalid.

(height: int)

Source from the content-addressed store, hash-verified

1800
1801
1802def _validate_tree_height(height: int) -> None:
1803 """Check if the height of the binary tree is valid.
1804
1805 :param height: Height of the binary tree (must be 0 - 9 inclusive).
1806 :type height: int
1807 :raise binarytree.exceptions.TreeHeightError: If height is invalid.
1808 """
1809 if not (type(height) == int and 0 <= height <= 9):
1810 raise TreeHeightError("height must be an int between 0 - 9")
1811
1812
1813def _generate_perfect_bst(height: int) -> Optional[Node]:

Callers 3

treeFunction · 0.85
bstFunction · 0.85
heapFunction · 0.85

Calls 1

TreeHeightErrorClass · 0.90

Tested by

no test coverage detected