The Inorder sequence of the tree is “bbaaabb” which is a palindromic string.
The Inorder sequence of the tree is “bbdaabb” which is not a palindromic string.
To solve the problem, refer to the following steps:
- Convert the given Binary Tree to a Doubly Linked List.
- This, reduces the problem to Check if a doubly linked list of characters is palindrome or not.
Below is the implementation of above approach:
Time Complexity: O(N)
Auxiliary Space: O(1)
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.
- Check if the level order traversal of a Binary Tree results in a palindrome
- Construct Special Binary Tree from given Inorder traversal
- Inorder Non-threaded Binary Tree Traversal without Recursion or Stack
- Calculate height of Binary Tree using Inorder and Level Order Traversal
- Check if a binary tree is subtree of another binary tree using preorder traversal : Iterative
- Check if an array represents Inorder of Binary Search tree or not
- Given level order traversal of a Binary Tree, check if the Tree is a Min-Heap
- Cartesian tree from inorder traversal | Segment Tree
- Inorder traversal of an N-ary Tree
- Inorder Tree Traversal without Recursion
- Inorder Tree Traversal without recursion and without stack!
- Find all possible binary trees with given Inorder Traversal
- Check if a given array can represent Preorder Traversal of Binary Search Tree
- Check if the given array can represent Level Order Traversal of Binary Search Tree
- Level order traversal of Binary Tree using Morris Traversal
- Construct Full Binary Tree using its Preorder traversal and Preorder traversal of its mirror tree
- Construct a Binary Tree from Postorder and Inorder
- Inorder Successor of a node in Binary Tree
- Print K inorder successors of a Binary Tree in O(1) space
- Replace each node in binary tree with the sum of its inorder predecessor and successor
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.