Dsa
Trees
Medium
Complete Binary Tree Check
Given a binary tree represented in level-order format (using '#' for null nodes), determine if it is a complete binary tree. A complete binary tree is a binary tree in which every level, except possibly the last, is filled. Write a function that reads the binary tree from standard input and prints 'True' if it is complete, or 'False' otherwise.
Input format:
- The first line contains a space-separated list of values representing the binary tree in level-order.
Output format:
- 'True' or 'False' depending on whether the tree is complete or not.
Example:
Input:
1 2 3 4 5 6
Output:
True
Key concepts
treescomplete binary treelevel order traversal
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now