P19949 [GeeksforGeeks] Complete binary tree
普及
题目描述

Given a Binary Tree, write a function to check whether the given Binary Tree is Complete Binary Tree or not. A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes should be as much close to left as possible.
Example 1:
Input:
1
/ \
2 3
Output:
Complete Binary Tree
Example 2:
Input:
1
/ \
2 3
\ / \
4 5 6
Output:
Not Complete Binary Tree
Constraints:
1<=Number of Node<=100
0 <= Data of a node <= 10^{6}
Your Task:
You don't need to take input. Just complete the function isCompleteBT() that takes root node as a parameter and returns true, if the tree is Complete else returns false.

输入格式

见题面

输出格式

见题面

样例输入
1 / \ 2 3
样例输出
Complete Binary Tree