Nice explanation. There is another option that is available to check if 2 Binary Trees are mirror images of each other. Take an inorder traversal of the nodes of tree 1 and tree 2 and iff they are mirror images, the inorder sequence will also be a mirror image. So we can reverse 2nd sequence and match with the first one. In your example, inorder traversal of tree 1 is "dbeafch" and for 2nd tree is "hcfaebd". One is the reverse of the other
I like how you take complex concepts and explain them in a very simple way. Your simulations are very easy to follow.!! Thanks!! Keep up the good work.
we can also solve this by checking level order traversal. If level order traversal of 1st tree are exactly in reveres of level order traversal of second then its a mirror image. Level order is achieved easier with queues.
Nice explanation. There is another option that is available to check if 2 Binary Trees are mirror images of each other. Take an inorder traversal of the nodes of tree 1 and tree 2 and iff they are mirror images, the inorder sequence will also be a mirror image. So we can reverse 2nd sequence and match with the first one.
In your example, inorder traversal of tree 1 is "dbeafch" and for 2nd tree is "hcfaebd". One is the reverse of the other
Thanks for the trick
No it won't work if all the nodes hav same data
I like how you take complex concepts and explain them in a very simple way. Your simulations are very easy to follow.!! Thanks!! Keep up the good work.
we can also solve this by checking level order traversal. If level order traversal of 1st tree are exactly in reveres of level order traversal of second then its a mirror image. Level order is achieved easier with queues.
best teacher for datastructures
This was brilliant explanation Sir
Best explanation . Please add more videos on Ds and Algo. Thanks a lot.
Thank you so much!!! your explanation are very clear. i usually look for for your videos whenever i get stuck.
Thank you so much, your explanation is amazing 🙏🏻
isMirror function should return boolean instead of int
2nd condition is wrong , we have to use XOR operation instead of OR because OR is true when both are true.
Best explanation. But Sometimes even running twice speed , I still feel very slow.
Hi sir very good morning as you doing fabulous job so I have a small request can it be possible to traverse breath first search using loops
Bro you are GEM !Genious
Thank you very much. You helped clear up some confusion I had.
Amazing 😍
great example
Thank you
Thank uh
play at 1.5 thanks me later