Question

1) Write in pseudocode an algorithm that receives as input the root of a tree and it returns true if the tree is a proper binary tree (i.e. each internal node has 2 children) and false otherwise. Assume that r.children is the number of children of a node r.

2) Compute the time complexity of the above algorithm in the worst case as a function of the number n of nodes