leaves_in_subtree#

BinTreeNode.leaves_in_subtree(max_depth: int | None = None) list[Node]#

Find all leaves in the binary tree.

Parameters#

max_depth

The maximum depth to search. If max_depth is not None then max_depth is the number of layers which are checked.

Returns#

list of BinTreeNode

The found nodes.