Types of Recursion (Part 2) | Tail & Non-tail Recursion

Поділитися
Вставка
  • Опубліковано 31 січ 2025

КОМЕНТАРІ • 397

  • @babatundelawal8096
    @babatundelawal8096 Рік тому +7

    After searching everywhere for a proper explanation to tail recursion. I found this. This is great, thank you

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

    Thank you so much! I have been confused whole day about the concept of tail recursion, you just help me to have a good night sleep~

    • @RitikSharma-pc5yj
      @RitikSharma-pc5yj 4 роки тому +3

      same happen with me today...I thought, just wasted my whole day but this video cleared my whole concept. hence my hard work pays off that I found this video....thankyou so much.

    • @nihalpandey5675
      @nihalpandey5675 4 роки тому +1

      Same here

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

    Seriously you are doing a great job for all of us . ✌️✌️ Thank you so much 💓💓

  • @mustafaabozaina2787
    @mustafaabozaina2787 2 роки тому +33

    Tail recursion performance is considered better than Non-Tail recursion because tail recursion is the last line executed so there's nothing left to do before leaving the function, this helps the compiler to optimize the execution because the function's stack frame need not be saved

    • @aj.arunkumar
      @aj.arunkumar Рік тому +1

      this should hv been included in the video.. thanks

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

    Sir ,why I not met such Teacher during my Graduation, Thanks a lot for wonderful teaching.

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

      Bro I am in Graduation.
      and I thing I am lucky to find this teacher

  • @p.gaurav.n.m2417
    @p.gaurav.n.m2417 5 років тому +16

    i am very happy that u people are helping us in almost all subjects.On behalf of all , my very big thanks to Neso Academy.......

  • @sayeedhasansaim8355
    @sayeedhasansaim8355 4 роки тому +142

    Both of theme are non-tail recursion. 😊

  • @lakshmiprasannachilukuri8814
    @lakshmiprasannachilukuri8814 4 роки тому +263

    I request neso academy to give answers to the home work problems in the comment section...It will be even better if u explain them...

  • @hosmjrshinh2675
    @hosmjrshinh2675 4 роки тому +64

    9:06 My dear friend let me tell you one thing😘

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

    It's really helpful video, I always confused about recursion function but now everything is cleared about recursion

  • @sri7169
    @sri7169 3 роки тому +9

    you guys doing a great job helping people WHO LOOKING out for knowledge # EDUCATION IS NOT A BUISNESS

  • @adnansarkar9219
    @adnansarkar9219 3 роки тому +69

    both program 1 & 2 are non-tail recursion functions, But program 2 has no step to go base so it will be infinite.

  • @bhaskarjyotigogoi9236
    @bhaskarjyotigogoi9236 4 роки тому +77

    Both are Non Tail Recursive function. In Program 2 the range of int from -2^(31) to +2^(31)-1....When n=2^31 then it exceeds the range of int and again start from -2^(31) which is less than 0..

    • @nuwaver91
      @nuwaver91 3 роки тому +10

      Are they both Non Tail Recursive because printf is the last thing in the function?

    • @nishantraj9762
      @nishantraj9762 2 роки тому +3

      @@nuwaver91 yeah both are non tail recursive function

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

    Your videos really helped me out to understand many things on recursive exactly to the point.

  • @SRI-PRIYAN
    @SRI-PRIYAN 4 роки тому +28

    Most of the people think that the 2nd program is wrong and does not converge into the base case but it actually converges...
    It ia because int overflow even when the output is 1(the smallest positive number) the recursion can run only upto 32 times because an int is 4 bytes which is 32 bits...
    At n=1 the first bit is set and when n=2 second bit is set and so on... When it reaches the 32nd bit n is no longer a positive number and the program returns.

    • @kevint3522
      @kevint3522 11 місяців тому

      Great comment! I'm glad I scrolled down and found it. Thank you!

  • @SejalSakhare-y3u
    @SejalSakhare-y3u Рік тому +3

    Ans=> PR-1: non-tail recursion function
    output : 0 (zero)
    PR-2:non-tail recursion function
    it is infinite loop.

  • @a_k1817
    @a_k1817 4 роки тому +18

    Till now i can say that your LEGENDRY TEACHER

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

    Your voice is impressive and the way u teach is amazing

  • @Post-random_post
    @Post-random_post 4 роки тому +8

    Amazing lectures i never see this type of explaination aswome

  • @indhujag5920
    @indhujag5920 3 роки тому +43

    Both are non-tail recursion. I executed Program 2 in Visual Studio Code. I took n=3.I got output and it prints from 3,6,12 upto byte limit and again return that from byte limit to 3. Program 2 is not infinte loop. It executes upto the byte limit of the computer and last line is also executed after return.

    • @randomguy8577
      @randomguy8577 2 роки тому +2

      Thanks 😊

    • @twiz8859
      @twiz8859 2 роки тому

      But in second program indeed value got true and finally if got executed but there is a printf before recursive procedure and after if being executed, there is, that printf statement left to be executed and second thing we didn't put rescursive procedure in else construct which mean still recursive procedure got executed anyway and in program 1 when value got zero recursive again isn't in else construct it still executed value 0;

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

    Thank you so very much for your wonderful lectures, Sir!!

  • @devkinandansharma7558
    @devkinandansharma7558 4 роки тому +4

    sir I can see your hard work in your videos

  • @RishiSingh-dj9ou
    @RishiSingh-dj9ou 4 роки тому +2

    Such a great teacher @jaspreet sir

  • @Chillvibe77
    @Chillvibe77 4 роки тому +5

    Your style of explaination is excellent ♥️

  • @Trippykiyay
    @Trippykiyay 2 роки тому

    This is the best explanation of recursion that I’ve ever seen.

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

    A very big thanks to you sir for clearing my doubts on recursion

  • @SandhyaSingh-ms6br
    @SandhyaSingh-ms6br 4 роки тому +15

    Part 1 and part 2 both are great examples of non-tail recursion, in fact, 2nd code is very useful if you want to revise the concept of range of "int" along with studying type of recursion, .....
    In the same code(2nd homework code) if we change any one of the two printf statements and print 2*n instead of n, then we'll notice that as the size of n doubles each time during recursive calling then as it reaches 1073741824, the recursive function that will be called by fun2(1073741824) will be fun2(-2147483648) [since max value of int is 2147483647] and as -214.... is less than zero therefore the base condition is met and thereafter the second printf statement will start getting executed and the functions will simultaneously pop out from the stack. The output obtained in this case (where we are printing 2*n instead of n clearly shows this)

  • @tanviranjum6463
    @tanviranjum6463 3 роки тому +7

    Both of them are non - talil recursive function.🙂🙏

  • @QQ-gn7tc
    @QQ-gn7tc 2 роки тому

    This channel shoud be given an award from @UA-cam.

  • @ninoherrera3944
    @ninoherrera3944 4 роки тому +8

    Well explained great job Neso Academy!

  • @rudranshnemade6299
    @rudranshnemade6299 3 роки тому +9

    Yes both the 2 programs are non tail recursive because the recursive call is not the last thing done by function and in both the process we need the previous function record.

    • @sahryun
      @sahryun 10 місяців тому

      if thats the case there exist no tail recursion at all, tail recursion should be removed from textbooks

  • @robertsedgewick1266
    @robertsedgewick1266 4 роки тому +5

    Brilliant explanation, stack frames were very well illustrated!

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

    both are non-tail recursive function as recursion calll is not the last thing done by funcion

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

      print f is also be a functon

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

      No only 1st is non-tail because in 2nd function will never return and last printf will never get evaluated so here only function call is the last thing done so tail recursive. No Sorry last printf will be evaluated as integer overflow will occur and n

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

      @@adarshverma013 why last print will never evaluated?

    • @damnnations9308
      @damnnations9308 4 роки тому +2

      @@omaranas2965 because it is an infinite loop

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

      @@damnnations9308 aha ty bro

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

    Sir, thinks so much for that! I've finally got it!

  • @kousalyakommula1322
    @kousalyakommula1322 3 роки тому +1

    sir your channel is a boon for us

  • @BeastGaming-hq6yu
    @BeastGaming-hq6yu 4 роки тому +1

    1 2 non tail
    1) value can be zero
    2) value can not be zero as well
    1) n=4 then 4/2=2 2%2=0 done.
    2) n=1 then pt=1 , 2*1= 2 , pt=2 goes on... value wont be zero
    any value after zero can never be greater then zero.

  • @Hgh38
    @Hgh38 4 роки тому +2

    Finally got it! You are a hero!

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

    Thanks to your Recursion videos not only did I understand this issue, but also learnt something. So thanks. :D

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

    very beautiful explaination ..great work

  • @dr.nicksiz8251
    @dr.nicksiz8251 2 роки тому +1

    Thank you all for these videos, my master. Probably you did intently but in the end , program 2 will get an stack overflow error. That doesnt satisfy the base statement.

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

    The 1st program is a non-tail recursive, but the 2nd one is a tail recursive program. That is because the recursion will enter an infinite recursion making it impossible for the printf to be executed. Therefore, the recursion remains the last thing to be called.

  • @0x656e
    @0x656e 4 роки тому +2

    My dear friend you're the best 🙌❤

  • @Aabara_ka_dabara
    @Aabara_ka_dabara Рік тому +2

    please also make one vide on void functins and return 0 ,return 1 diffrence

  • @arunkumarkurapati8093
    @arunkumarkurapati8093 11 місяців тому

    Both of the given questions are the examples of non-tail recursive functions. As we are performing a modulo operation in the printf statement of first program and printing the value of n in the second program.

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

    @0:50, fun function has type void and yet it is returning some value at line 6 of the code.

    • @omkargulave5774
      @omkargulave5774 4 роки тому +1

      It is returning void function so it is absolutely fine. And other easy way to understand is fun(n) returning to fun(n-1). And if function is void it doesn't mean that function doesn't return anything it returns void.

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

    A very big THANKS...... You are really doing a very great job ..... I was really very confused about tail and non-tail both ..... Even after asking my lecturer thrice I won't be able to get it properly..... But u made me understand ...... A very big THANKS again.....

  • @krishpatil9609
    @krishpatil9609 4 роки тому +1

    I assumed n==5;
    When fun(2*5) will be called, it will start to print 5 10 20 40.......1342177280
    Iteration/recursion is possible until value of n reaches 2147483647(max range for signed int)
    Since we are using fun(2*n)
    i.e. when value of n reaches 1342177280 then after 2*n will exceed the range of n
    i.e. fun(2684354560)
    , i.e. value of n will become -ve (lec 8).
    And as stated if(nn i.e.
    n=1342177280 i.e. fun(2*671088640) and fun will pop out
    then
    671088640 then fun will popp
    ....
    .....
    n=10 i.e. fun(2*5)
    Now fun(2*5) will popp out and control will return to main and then main will popp out.

  • @cs21deepalijaiswal84
    @cs21deepalijaiswal84 4 роки тому +5

    Thank you so much sir for these lectures.C is our building block and you r letting us learn all our concepts with so ease.Warm regards!!!

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

      Hey depali would you got placed I m from ur clg

  • @viveknirmal4811
    @viveknirmal4811 4 роки тому +30

    PROGRAM 1 = NON TAIL RECURSIVE
    PROGRAM 2 = TAIL RECURSIVE
    AS LAST PRINTFF WILL NOT GET EVALAUTE BUT IT LEADS TO STACK OVERFLOW

    • @tokomnyori6730
      @tokomnyori6730 4 роки тому +9

      The printf does evaluate. I've tested both programs and found out that both are non-tail recursive. I entered an input of 8, after hitting 1073741824 it went down to -2147483648 and triggered the base case. After the integer overflow, it prints the result in reverse. Please explain if I'm wrong.

    • @selvamsaravanan1095
      @selvamsaravanan1095 4 роки тому +2

      @@tokomnyori6730 u r ri8

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

      @@selvamsaravanan1095 Thanks 😊

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

      Exactly true

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

      Vivek nirma you are right 1.non tail and 2. Tail because printf is not evolut it may be leads to stack over flow so printf function not be evoluted so it is an tail recursive and in program 1. Fun2(0) arises and then printf should be evoluted so it is non tail

  • @codingawarenes
    @codingawarenes 4 роки тому +1

    Veryy nice explanation thank u sir

  • @kera2403
    @kera2403 3 роки тому +1

    In case of tail recursion there is no need to maintain the stack because the function call is the last thing thats happening. That is why tail recursion is preferred.

  • @atharvakulkarni3007
    @atharvakulkarni3007 6 років тому +7

    1st is Non Tail but 2nd there is no base condition therefore it'll be in an ∞ loop but I can guess it as Tail because there there is nothing to do after calling the function in the function

    • @AbhishekKumar-kk6qs
      @AbhishekKumar-kk6qs 5 років тому +11

      Your answer is absolutely correct but there is base condition given(n

    • @kumarparaskaran7598
      @kumarparaskaran7598 4 роки тому +4

      @@AbhishekKumar-kk6qs but when 2*n will exceed the integer range based on computer, then n will become negative( let us assume if int is 2 byte then after 32766 n will become -32768) and it will return, so I guess that 2nd is also non tail recursive

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

      @@kumarparaskaran7598 this is the correct analysis !

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

      both are non-tail recursive function
      because 2nd function is dependent upon the value you passed, if it will be greater number then the value multiplied with 2 will doubled and so on therefor 3 or 4 values are only printed by 1st printf function and then value will be negative (you know signed int concept) so 2nd printf will execute,too.
      for ex you can pass n as 536870900(nearer value of max signed value/4) so you get only 3 values WHICH is printed by 1st printf and 3 values which are printed by 2nd printf(which is same but in reverse position).
      SO, AT THE END NOTH ARE NON-TAIL RECURSIVE FUNCTION

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

      No, Program 2 is non - tail recursive. Check out output in Visual Studio code.

  • @niteshmodi5468
    @niteshmodi5468 3 роки тому +8

    If teacher like you would be there in college then the scenario of student's life would be different...

  • @KuldeepSingh-rm2nr
    @KuldeepSingh-rm2nr 6 років тому +2

    Best channel to learn data structure....loved it😍

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

    Because of your legendary lectures, now I fell in love with India.

  • @sagnikmukherjee6604
    @sagnikmukherjee6604 4 роки тому +1

    This was a great explanation of the topic that was about to drive me crazy... Thanks and keep it up

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

    both are non-tail recursive function
    because 2nd function is dependent upon the value you passed, if it will be greater number then the value multiplied with 2 will doubled and so on therefor 3 or 4 values are only printed by 1st printf function and then value will be negative (you know signed int concept) so 2nd printf will execute,too.
    for ex you can pass n as 536870900(nearer value of max signed value/4) so you get only 3 values WHICH is printed by 1st printf and 3 values which are printed by 2nd printf(which is same but in reverse position).
    SO, AT THE END NOTH ARE NON-TAIL RECURSIVE FUNCTION

  • @sowbhagyalakshmi7984
    @sowbhagyalakshmi7984 2 місяці тому

    This channel ❤❤

  • @tanjibmahammad1216
    @tanjibmahammad1216 3 роки тому +1

    Thanks for this, Sir. It saves a bunch of time of mine.

  • @manvithavemulapalli2535
    @manvithavemulapalli2535 4 роки тому +1

    really good viedio I have ever seen tq neso academy!!!

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

    i really appreciate this effort thank you very much❤❤❤❤

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

    Program 2 : base case not correct;
    Will execute till the stack overflow

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

      what if the n is negative value?

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

      @@daverussell4052 for neg it will not overflow

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

      I think for negative value it will return back to main() [or the function that called it]
      Because.. the if condition becomes true so it returns back to the function that called it..

  • @abhaypratap9898
    @abhaypratap9898 3 роки тому +3

    Please suggest any book for such questions 🥺🥺🥺

  • @Rani_6329
    @Rani_6329 2 роки тому

    Thank you so much....very useful 👍

  • @nik-ys8ki
    @nik-ys8ki 4 роки тому +2

    program 1 - not-tail program
    program 2: this program is very interesting though . if u paas a value than it will stop at that same value because when it exceeds the range of data type it has to come back.

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

      Can u please send me solution of these homework problems

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

      I can't solve this

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

      @@lakshitavij8600 Program 2 is non - tail recursive. Check out output in Visual Studio code.

  • @rushikothari1261
    @rushikothari1261 4 роки тому +1

    Program 2 will make function call until Stack overflow condition occur. Hence the Output is Stack overflow Error. And it is Tail recursion

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

      How is it tail?
      If the condition changes,It will be non-tail.

    • @rushikothari1261
      @rushikothari1261 4 роки тому +1

      @@nandinisunkara4070 Does 2nd printf Executed atleast 1 time ? Ans is No..
      Therefore, programs are just like Pf() Recursive()

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

      Not stack overflow, integer overflow. Stack overflow is different than integer overflow. Both are non-tail recursive. In the second program, integer will hit its limit and will become negative negative number and it will hit the base case. It is non-tail recursive because it will evaluate the printf statement below.

    • @rushikothari1261
      @rushikothari1261 4 роки тому +1

      @@tokomnyori6730 In which data structure Integer are stored in Computer?

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

      No, Program 2 is non - tail recursive. Check out output in Visual Studio code. Func will just executes upto the Byte limit and starts returning back and last line is executed.

  • @jagdeepsingh-tv4ty
    @jagdeepsingh-tv4ty 5 років тому +7

    program 2 will fallback ,it will not go into infinite loop
    may be the stack has limited memory

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

    we can't use return in a void function like what did you do in the example of the tail recursion

  • @charuarora6621
    @charuarora6621 3 роки тому +1

    Recursion is my fear point in C programming 🙌🏻 but if(!rocketscience){printf("It can be learned
    ");

  • @nehagull1052
    @nehagull1052 4 роки тому +2

    sir can you please make a video on binary recursion??

  • @RhaenyraT2001
    @RhaenyraT2001 Рік тому +1

    why was the activation record of fun(0) not stored in the stack in example 1?? The activation record is stored when a function is called right? fun(0) was called.

  • @nickbeats9883
    @nickbeats9883 3 роки тому +1

    This activation record thing is cool

  • @MuhammadNaveed_51
    @MuhammadNaveed_51 10 місяців тому

    great job man

  • @yaxinee
    @yaxinee Місяць тому

    Thank u that what i needed

  • @belwizdadimed3967
    @belwizdadimed3967 6 років тому +2

    The stack usage is the same. you didn't show the optimization (by compiler) gained from the fact that it's a tail recursion. Someone can argue about the need to differentiate them since we may assume that explicit/implicit return is the last instruction that triggers the stack pop().

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

      use gcc -O2 to enable tail recursion in C.

    • @belwizdadimed3967
      @belwizdadimed3967 6 років тому +1

      Konstantin Rebrov you didn't understand my point and hrnce you're responding to a question I didn't ask

  • @mr.schrodinger7
    @mr.schrodinger7 Рік тому +1

    1st is non tail recursive. 2nd is tail recursive

  • @anjaneyuluperam6076
    @anjaneyuluperam6076 6 років тому +7

    both r non tail recursive functions

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

    Awesome 👌

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

    Sir ur explaining well bt please reveal answers in nxt video so tat beginners can get some idea…it’s ah kind request from us sir..🥺

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

    This was so incredibly helpful!!!

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

    Thanku sir 🙏

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

    Bro you use the word "evaluate" in a wrong manner. I think sometimes you mean to say "execute" which is different than "evaluating". You don't evaluate a print statement, you execute it.
    Thanks for the tutorial though :)

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

      We are studying C language not english

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

    Sir please u don't say thanq for watching to us when end of the video 🙏 bcz u r giving life to us ❤️

  • @maksberlec4832
    @maksberlec4832 4 роки тому +2

    Both functions are non-tail. They all have printf after the function call.

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

      2nd is not a recursive program

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

      @@madhusudansahu5482I do not know how you came to this conclusion. The second function is recursive for sure because it call itself. The recursion is also non-tailed. The n variable become negative because it overflows at 2^31 (integer variable). After that the second printf gets executed. Finally I tested my conclusion with the program:
      #include
      #include
      void fun2(int n) {
      if (n

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

      Can u explain the line of yours "n becomes negative bcz it overflows at 2^31." a bit more. I'm not able to grab this concept clearly.

  • @HelloWorld40408
    @HelloWorld40408 2 роки тому

    Thank You SIr

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

    thank you sir .well expalained

  • @shikshitverma1684
    @shikshitverma1684 4 роки тому +2

    Sir plesse give the answer of homework problem in the next video for satisfaction.

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

    Such a good explanation

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

    Thanks for the lecture especially the tail recursion part which was very confusing for me..

  • @unknownfacts8929
    @unknownfacts8929 10 місяців тому

    Both are non-tail recursive 😊

  • @kathanparekh6135
    @kathanparekh6135 3 роки тому +1

    2:28 Sir VOID return type wala function kuch return nahi karta instead use INT as return type

  • @bhuwan9991
    @bhuwan9991 6 років тому +3

    program 1 is non tail recursive , but I can't say about program 2 because it will call itself again and again. since n*2 will increase the value passed to the fun2 and it will never go to the end condition i.e. n

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

      I guess the integer overflow explains the function getting terminated

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

      No, Program 2 is non - tail recursive. Check out the output in Visual Studio code.

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

    Good video 👍

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

    Thankyou neso academy

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

    Sir please make a video on tower of Hanoi

  • @chitrangreddy6479
    @chitrangreddy6479 4 роки тому +1

    1 st one is non tail recursive and second one is tail recursive ...❤

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

      How come the second one is tail recursive?

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

      @@brocklesnarufcchamp1 perhaps there is nothing to evaluate after function calling they simply print n

  • @RahulGupta-hj9bn
    @RahulGupta-hj9bn 4 роки тому

    Program is 1 is Non Tail Recursion and Program 2 is Tail Recursion because after if condition print execute but it is no need to store then second recursive call not get value of n .

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

      No, Program 2 is non - tail recursive. Check out output in Visual Studio code

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

    1st one is non-tail recursive program
    2nd one is tail recursive but it will run infinite no. of times..output:444444.....

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

      No, Program 2 is non - tail recursive. Check out output in Visual Studio code.

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

    First program is non tail recursive function and the second one is infinite

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

    1 program is non tail recursive.
    2 program is tail recursive.
    Kindly please tell me correct answer
    Sir .
    Thank you so much for wonderful seccion.

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

      No, Program 2 is non - tail recursive. Check out output in Visual Studio code.