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)
| 1800 | |
| 1801 | |
| 1802 | def _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 | |
| 1813 | def _generate_perfect_bst(height: int) -> Optional[Node]: |
no test coverage detected