Check Mirror of Binary Tree

preview_player
Показать описание
Given two binary trees. Check whether they are mirror reflections of each other or not.
Рекомендации по теме
Комментарии
Автор

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

saurabhgokhale
Автор

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.

sarangborude
Автор

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.

sunilkoni
Автор

Thank you so much!!! your explanation are very clear. i usually look for for your videos whenever i get stuck.

yvestuyishime
Автор

Best explanation . Please add more videos on Ds and Algo. Thanks a lot.

ChandraShekhar-bycd
Автор

Thank you so much, your explanation is amazing 🙏🏻

amirayasmine
Автор

Thank you very much. You helped clear up some confusion I had.

HStopford
Автор

2nd condition is wrong, we have to use XOR operation instead of OR because OR is true when both are true.

tejaswgaur
Автор

isMirror function should return boolean instead of int

narendratechguy
Автор

Best explanation. But Sometimes even running twice speed, I still feel very slow.

atishnarlawar
Автор

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

ApDisciples