Convert a tree into a binary tree.
In general a
TreeNodecan have more or less than two children. However guide trees usually expect each intermediate node to have exactly two child nodes. This function creates a binary
TreeNode) for the given
TreeNode): Intermediate nodes that have only a single child are deleted and its parent node is directly connected to its child node. Intermediate nodes that have more than two childs are divided into multiple nodes (distances are preserved).
- tree_or_nodeTree or TreeNode
The tree or node to be converted into a binary tree or node.
- binary_tree_or_nodeTree or TreeNode
The converted tree or node.