Check if the binary tree is complete. A binary tree is complete if it meets the following criteria: * All levels except possibly the last are completely filled. * Last level is left-justified. :return: True if the binary tree is complete, False otherwise. :
(self)
| 1336 | |
| 1337 | @property |
| 1338 | def is_complete(self) -> bool: |
| 1339 | """Check if the binary tree is complete. |
| 1340 | |
| 1341 | A binary tree is complete if it meets the following criteria: |
| 1342 | |
| 1343 | * All levels except possibly the last are completely filled. |
| 1344 | * Last level is left-justified. |
| 1345 | |
| 1346 | :return: True if the binary tree is complete, False otherwise. |
| 1347 | :rtype: bool |
| 1348 | |
| 1349 | **Example**: |
| 1350 | |
| 1351 | .. doctest:: |
| 1352 | |
| 1353 | >>> from binarytree import Node |
| 1354 | >>> |
| 1355 | >>> root = Node(1) |
| 1356 | >>> root.left = Node(2) |
| 1357 | >>> root.right = Node(3) |
| 1358 | >>> root.left.left = Node(4) |
| 1359 | >>> root.left.right = Node(5) |
| 1360 | >>> |
| 1361 | >>> print(root) |
| 1362 | <BLANKLINE> |
| 1363 | __1 |
| 1364 | / \\ |
| 1365 | 2 3 |
| 1366 | / \\ |
| 1367 | 4 5 |
| 1368 | <BLANKLINE> |
| 1369 | >>> root.is_complete |
| 1370 | True |
| 1371 | """ |
| 1372 | return _get_tree_properties(self).is_complete |
| 1373 | |
| 1374 | @property |
| 1375 | def min_node_value(self) -> NodeValue: |
nothing calls this directly
no test coverage detected