Check Mirror of Binary Tree

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • Given two binary trees. Check whether they are mirror reflections of each other or not.
    Full code available at:- github.com/viv...

КОМЕНТАРІ • 21

  • @saurabhgokhale6466
    @saurabhgokhale6466 6 років тому +8

    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

  • @sarangborude8260
    @sarangborude8260 5 років тому +5

    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.

  • @sunilkoni1843
    @sunilkoni1843 4 роки тому +3

    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.

  • @srinidhiii
    @srinidhiii 7 років тому +1

    best teacher for datastructures

  • @Kgp-ty5dk
    @Kgp-ty5dk 7 років тому +2

    This was brilliant explanation Sir

  • @ChandraShekhar-by3cd
    @ChandraShekhar-by3cd 4 роки тому

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

  • @yvestuyishime5209
    @yvestuyishime5209 4 роки тому

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

  • @amirayasmine8490
    @amirayasmine8490 Рік тому

    Thank you so much, your explanation is amazing 🙏🏻

  • @narendratechguy7140
    @narendratechguy7140 6 років тому +5

    isMirror function should return boolean instead of int

  • @tejaswgaur8813
    @tejaswgaur8813 3 роки тому

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

  • @atishnarlawar1177
    @atishnarlawar1177 6 років тому

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

  • @BTruthS
    @BTruthS 4 роки тому

    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

  • @unboxingzindagi9972
    @unboxingzindagi9972 4 роки тому

    Bro you are GEM !Genious

  • @HStopford
    @HStopford 6 років тому

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

  • @nagesh007
    @nagesh007 Рік тому

    Amazing 😍

  • @pl5778
    @pl5778 5 років тому

    great example

  • @DalerAsrorov
    @DalerAsrorov 5 років тому

    Thank you

  • @rajeevkumaryadav3072
    @rajeevkumaryadav3072 5 років тому

    Thank uh

  • @hridayjyotiborkakati3449
    @hridayjyotiborkakati3449 2 роки тому +1

    play at 1.5 thanks me later