Question: 1. (20 points) Every node in a binary tree can have 0, 1 or 2 children. A leaf node has no children. Write a Python

1. (20 points) Every node in a binary tree can have 0, 1 or 2 children. A leaf node has no children. Write a Python function to decide whether all nodes, except leaves, in a tree have exactly two children # Input: a node which is the root of the tree # Output: True if all nodes in the tree have either 0 or 2 children False if some node has only one child. # (leaves) or exactly two children (internal nodes) def is full_house( root node ): # your code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
