Given a binary tree and the task if to check if it’s level order traversal results in a palindrome or not.
RADAR is the level order traversal of the
given tree which is a palindrome.
- Traverse the Binary Tree in level order and store the nodes in a stack.
- Traverse the Binary Tree in level order once again and compare the data in the node with the data at top of stack.
- In case there is a match, move on to the next node.
- In case there is a mismatch, stop and print No.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Level order traversal of Binary Tree using Morris Traversal
- Given level order traversal of a Binary Tree, check if the Tree is a Min-Heap
- Print a Binary Tree in Vertical Order | Set 3 (Using Level Order Traversal)
- Flatten Binary Tree in order of Level Order Traversal
- Print nodes of a Binary Search Tree in Top Level Order and Reversed Bottom Level Order alternately
- Insertion in n-ary tree in given order and Level order traversal
- Check if the given array can represent Level Order Traversal of Binary Search Tree
- Connect Nodes at same Level (Level Order Traversal)
- Perfect Binary Tree Specific Level Order Traversal
- Perfect Binary Tree Specific Level Order Traversal | Set 2
- Build Binary Tree from BST such that it's level order traversal prints sorted data
- Density of Binary Tree using Level Order Traversal
- Calculate height of Binary Tree using Inorder and Level Order Traversal
- Boundary Level order traversal of a Binary Tree
- Specific Level Order Traversal of Binary Tree
- Deletion of a given node K in a Binary Tree using Level Order Traversal
- Flatten binary tree in order of post-order traversal
- Construct Full Binary Tree using its Preorder traversal and Preorder traversal of its mirror tree
- Level Order Tree Traversal
- General Tree (Each node can have arbitrary number of children) Level Order Traversal
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.