Find Kth Ancestor Of The given Node In Binary Tree

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ก.ย. 2024

ความคิดเห็น • 15

  • @yashpratapsingh2485
    @yashpratapsingh2485 2 ปีที่แล้ว +3

    Best solution till now present on youtube

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Thanks

  • @shivkant941
    @shivkant941 2 ปีที่แล้ว +1

    Good Solution...

  • @anujmishra778
    @anujmishra778 ปีที่แล้ว

    very nice and , very clear explanation sir thank you

    • @CppNuts
      @CppNuts  ปีที่แล้ว

      Thanks and welcome

  • @NaveensinglaYT
    @NaveensinglaYT 2 ปีที่แล้ว +1

    Correction I think we are not the value 7 actually we are returning the Node which contains value 7 i Know for some this might be same thing but for beginners it can get a little bit confusing

  • @gauravmane5282
    @gauravmane5282 8 หลายเดือนก่อน

    Nice Explanation 😊

    • @CppNuts
      @CppNuts  8 หลายเดือนก่อน

      Glad you liked it

  • @prateekshrivastava2802
    @prateekshrivastava2802 4 หลายเดือนก่อน +1

    thanks!!!!!

  • @abhisheksrivastava3699
    @abhisheksrivastava3699 2 ปีที่แล้ว

    Got confused returning root at line 26 will work I was in an impression it may give false alarm to parent cl that we found the target

  • @subendu4u
    @subendu4u ปีที่แล้ว

    Well, we are not avoiding recursion when the node is found isnt it?
    For example: getKthAncestor( root, 7, 1); will still undergo recursion for 2->right because 4 is returning NULL to 2, right?

    • @subendu4u
      @subendu4u ปีที่แล้ว

      I think removing the "return NULL;" when "k==0" should do the trick?

  • @ramakrishna4092
    @ramakrishna4092 2 ปีที่แล้ว +1

    Hi cpp nuts
    Is there any other way to become a patreon because my card was disabled for international transactions if you have any other way pls tell me I have also contacted my bank 🏦 they need more than a month .

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว +1

      Thanks for the consideration, but no man i don't know any other way..

    • @ramakrishna4092
      @ramakrishna4092 2 ปีที่แล้ว +2

      @@CppNuts ok sir thanks