After searching everywhere for a proper explanation to tail recursion. I found this. This is great, thank you
@hosmjrshinh26754 жыл бұрын
9:06 My dear friend let me tell you one thing😘
@sayeedhasansaim83554 жыл бұрын
Both of theme are non-tail recursion. 😊
@josuequintero-td5gh2 ай бұрын
Does the function stop being called when n overflows?
@mustafaabozaina27872 жыл бұрын
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 Жыл бұрын
this should hv been included in the video.. thanks
@zhiyizhu30405 жыл бұрын
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-pc5yj4 жыл бұрын
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.
@nihalpandey56754 жыл бұрын
Same here
@lakshmiprasannachilukuri88144 жыл бұрын
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...
@hetaeramancer3 жыл бұрын
@Curtis Phoenix no one gives a damn with your instapwn and your second dummy acc...
@laus-thecurious41202 жыл бұрын
Absolutely right
@kushagraacharya46292 жыл бұрын
Your message has been successfully read and ignored ✓✓
@tejavathusrilaxmitejavathu52242 жыл бұрын
@@laus-thecurious4120 Good
@sardarzain1066 Жыл бұрын
Yeah
@bhanukumar33645 жыл бұрын
Sir ,why I not met such Teacher during my Graduation, Thanks a lot for wonderful teaching.
@irfansari_2 жыл бұрын
Bro I am in Graduation. and I thing I am lucky to find this teacher
@bhaskarjyotigogoi92364 жыл бұрын
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..
@nuwaver913 жыл бұрын
Are they both Non Tail Recursive because printf is the last thing in the function?
@nishantraj97622 жыл бұрын
@@nuwaver91 yeah both are non tail recursive function
@p.gaurav.n.m24175 жыл бұрын
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.......
@adnansarkar92193 жыл бұрын
both program 1 & 2 are non-tail recursion functions, But program 2 has no step to go base so it will be infinite.
@aydinfurkancan Жыл бұрын
@@s.oktaydonmez649 adamsın knk iyi akıl ettin
@sardarzain1066 Жыл бұрын
Give signed value brother eg -10
@ergenbalik Жыл бұрын
@@s.oktaydonmez649 helal
@sruthimajhi5610 Жыл бұрын
It has a base cond.
@jsmphompho8052 Жыл бұрын
@@s.oktaydonmez649 thank you, I also forgot about this fact
@shradhajadhav56095 жыл бұрын
It's really helpful video, I always confused about recursion function but now everything is cleared about recursion
@RAHULYADAV-zr5fq3 жыл бұрын
Hii
@omchoudhary49315 жыл бұрын
Seriously you are doing a great job for all of us . ✌️✌️ Thank you so much 💓💓
@sri71693 жыл бұрын
you guys doing a great job helping people WHO LOOKING out for knowledge # EDUCATION IS NOT A BUISNESS
@iuseyoutubealot2 жыл бұрын
100% it shouldn't be
@indhujag59203 жыл бұрын
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.
@randomguy85772 жыл бұрын
Thanks 😊
@twiz88592 жыл бұрын
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;
@meenalsolanki92865 жыл бұрын
Your videos really helped me out to understand many things on recursive exactly to the point.
@a_k18173 жыл бұрын
Till now i can say that your LEGENDRY TEACHER
@AdityaSingh-ii4km3 жыл бұрын
❤
@SRI-PRIYAN4 жыл бұрын
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.
@kevint352210 ай бұрын
Great comment! I'm glad I scrolled down and found it. Thank you!
@SandhyaSingh-ms6br4 жыл бұрын
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)
@shreyapatel14003 жыл бұрын
Well explained thnk you dear
@godfather57773 жыл бұрын
This comment should be pinned. Thanku🙌
@sidharthjain21293 жыл бұрын
We will get a palindrome r8? In program 2
@prodiptamondal17583 жыл бұрын
thanks
@abdousaadi27153 жыл бұрын
cool explanation i thought the program would last forever thank you
@Post-random_post4 жыл бұрын
Amazing lectures i never see this type of explaination aswome
@rking27883 жыл бұрын
Your voice is impressive and the way u teach is amazing
@SejalSakhare-y3u Жыл бұрын
Ans=> PR-1: non-tail recursion function output : 0 (zero) PR-2:non-tail recursion function it is infinite loop.
@aakashverma86025 жыл бұрын
both are non-tail recursive function as recursion calll is not the last thing done by funcion
@addagallanaresh40445 жыл бұрын
print f is also be a functon
@adarshverma0135 жыл бұрын
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
@omaranas29654 жыл бұрын
@@adarshverma013 why last print will never evaluated?
@damnnations93084 жыл бұрын
@@omaranas2965 because it is an infinite loop
@omaranas29654 жыл бұрын
@@damnnations9308 aha ty bro
@muhammadalidildar5 жыл бұрын
@0:50, fun function has type void and yet it is returning some value at line 6 of the code.
@omkargulave57744 жыл бұрын
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.
@ravikumarsunkhesvarapu91225 жыл бұрын
Thank you so very much for your wonderful lectures, Sir!!
@Trippykiyay Жыл бұрын
This is the best explanation of recursion that I’ve ever seen.
@devkinandansharma75583 жыл бұрын
sir I can see your hard work in your videos
@QQ-gn7tc2 жыл бұрын
This channel shoud be given an award from @KZbin.
@rudranshnemade62993 жыл бұрын
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.
@sahryun9 ай бұрын
if thats the case there exist no tail recursion at all, tail recursion should be removed from textbooks
@DandelionHope6 жыл бұрын
A very big thanks to you sir for clearing my doubts on recursion
@robertsedgewick12664 жыл бұрын
Brilliant explanation, stack frames were very well illustrated!
@kennymccormic75785 жыл бұрын
Sir, thinks so much for that! I've finally got it!
@ninoherrera39444 жыл бұрын
Well explained great job Neso Academy!
@RishiSingh-dj9ou4 жыл бұрын
Such a great teacher @jaspreet sir
@tanviranjum64633 жыл бұрын
Both of them are non - talil recursive function.🙂🙏
@viveknirmal48114 жыл бұрын
PROGRAM 1 = NON TAIL RECURSIVE PROGRAM 2 = TAIL RECURSIVE AS LAST PRINTFF WILL NOT GET EVALAUTE BUT IT LEADS TO STACK OVERFLOW
@tokomnyori67304 жыл бұрын
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.
@selvamsaravanan10954 жыл бұрын
@@tokomnyori6730 u r ri8
@tokomnyori67304 жыл бұрын
@@selvamsaravanan1095 Thanks 😊
@darshitgajjar51994 жыл бұрын
Exactly true
@thebeatifulnature31424 жыл бұрын
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
@Chillvibe774 жыл бұрын
Your style of explaination is excellent ♥️
@Marianojoey Жыл бұрын
Thanks to your Recursion videos not only did I understand this issue, but also learnt something. So thanks. :D
@Aabara_ka_dabara Жыл бұрын
please also make one vide on void functins and return 0 ,return 1 diffrence
@kousalyakommula13223 жыл бұрын
sir your channel is a boon for us
@BeastGaming-hq6yu4 жыл бұрын
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.
@Hgh384 жыл бұрын
Finally got it! You are a hero!
@ashishchawla902 жыл бұрын
very beautiful explaination ..great work
@niteshmodi54683 жыл бұрын
If teacher like you would be there in college then the scenario of student's life would be different...
@entrtnmnthub53573 жыл бұрын
yep...i agree :")
@dr.nicksiz82512 жыл бұрын
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.
@kathanparekh61353 жыл бұрын
2:28 Sir VOID return type wala function kuch return nahi karta instead use INT as return type
@riathakur39365 жыл бұрын
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.....
@arasahmad91763 жыл бұрын
Because of your legendary lectures, now I fell in love with India.
@atharvakulkarni30076 жыл бұрын
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-kk6qs5 жыл бұрын
Your answer is absolutely correct but there is base condition given(n
@kumarparaskaran75984 жыл бұрын
@@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
@aninditpanigrahi33344 жыл бұрын
@@kumarparaskaran7598 this is the correct analysis !
@azcrypto15654 жыл бұрын
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
@indhujag59203 жыл бұрын
No, Program 2 is non - tail recursive. Check out output in Visual Studio code.
@cs21deepalijaiswal844 жыл бұрын
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!!!
@shivdix11 ай бұрын
Hey depali would you got placed I m from ur clg
@0x656e4 жыл бұрын
My dear friend you're the best 🙌❤
@RhaenyraT2001 Жыл бұрын
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.
@codingawarenes3 жыл бұрын
Veryy nice explanation thank u sir
@kera24033 жыл бұрын
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.
@KuldeepSingh-rm2nr6 жыл бұрын
Best channel to learn data structure....loved it😍
@sagnikmukherjee66044 жыл бұрын
This was a great explanation of the topic that was about to drive me crazy... Thanks and keep it up
@ismailyakini5922 жыл бұрын
we can't use return in a void function like what did you do in the example of the tail recursion
@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.
@tanjibmahammad12163 жыл бұрын
Thanks for this, Sir. It saves a bunch of time of mine.
@zawzawwin29185 жыл бұрын
Problem 1 is non-tail recursive and Problem 2 is infinity loop ........ I don't know please anyone know it explain me ...
@rachitsingh80404 жыл бұрын
yes there should be a return after printf. void func(int k){ if(k==0){ return; } func(k-1); printf("%d",k)' return; }
@nik-ys8ki4 жыл бұрын
no u r wrong it will stop at the same value which will be passed to it
@kushalavardhan4 жыл бұрын
It must be like this. void func(int k){ if(k==0){ return; } return func(k-1); printf("%d",k); }
@azcrypto15654 жыл бұрын
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
@manvithavemulapalli25354 жыл бұрын
really good viedio I have ever seen tq neso academy!!!
@mr.schrodinger7 Жыл бұрын
1st is non tail recursive. 2nd is tail recursive
@arvindersingh98635 жыл бұрын
Program 2 : base case not correct; Will execute till the stack overflow
@daverussell40523 жыл бұрын
what if the n is negative value?
@tusharmathur53603 жыл бұрын
@@daverussell4052 for neg it will not overflow
@bhavyaj30693 жыл бұрын
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..
@arunkumarkurapati809310 ай бұрын
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.
@abhaypratap98983 жыл бұрын
Please suggest any book for such questions 🥺🥺🥺
@tokomnyori67304 жыл бұрын
I've tested both programs and found out that both are non-tail recursive. I think the second program is not infinite because integer has its limit and it overflows and becomes zero or negative value. I entered an input of 8, after hitting 1073741824 it went down to -2147483648 and triggered the base case. Please explain if I'm wrong.
@konstantinrebrov6756 жыл бұрын
Both are non tail recursive. Why? Tail recursion is if the recursive function call is in the tail of the function, and there are no more operations like printing or multiply *. If there is nothing to be done after the next recursive function call, all the local variables calculations already happened and we don't need them anymore. In other words after executing the next recursive function call we will not need to access any data in the current stack frame anymore. If we do not need to access any data in the current recursive function call, we can just overwrite the current stack frame with the next stack frame. For both programs we are printing the int n after we are making the recursive function call, after we return. However, the value of int n is different for each recursive function call. Therefore the compiler has to store runtime stack to save us the state of the previous recursive function calls. If after we return from the recursion we will not use any local variables any more, we are telling the compiler to not save the current state of the runtime stack. So the compiler sees that the recursion is in the tail, and after that the function does not access any local variables so it can simply over write the current stack frame with the next stack frame.
@jacquelinepang78534 жыл бұрын
^ I believe this
@jagdeepsingh-tv4ty5 жыл бұрын
program 2 will fallback ,it will not go into infinite loop may be the stack has limited memory
@bhuwan99916 жыл бұрын
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
@dagadoom5 жыл бұрын
I guess the integer overflow explains the function getting terminated
@indhujag59203 жыл бұрын
No, Program 2 is non - tail recursive. Check out the output in Visual Studio code.
@nehagull10524 жыл бұрын
sir can you please make a video on binary recursion??
@nik-ys8ki4 жыл бұрын
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.
@lakshitavij86004 жыл бұрын
Can u please send me solution of these homework problems
@lakshitavij86004 жыл бұрын
I can't solve this
@indhujag59203 жыл бұрын
@@lakshitavij8600 Program 2 is non - tail recursive. Check out output in Visual Studio code.
@nickbeats98833 жыл бұрын
This activation record thing is cool
@charuarora66213 жыл бұрын
Recursion is my fear point in C programming 🙌🏻 but if(!rocketscience){printf("It can be learned ");
@abigailbusch7543 жыл бұрын
This was so incredibly helpful!!!
@krishpatil96094 жыл бұрын
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.
@krishpatil96094 жыл бұрын
This is for 2nd program.
@azcrypto15654 жыл бұрын
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
@sowbhagyalakshmi79842 ай бұрын
This channel ❤❤
@AbdallahAnalyst Жыл бұрын
i really appreciate this effort thank you very much❤❤❤❤
@Rani_63292 жыл бұрын
Thank you so much....very useful 👍
@anjaneyuluperam60765 жыл бұрын
both r non tail recursive functions
@paurushgargtube4 жыл бұрын
Such a good explanation
@rushikothari12614 жыл бұрын
Program 2 will make function call until Stack overflow condition occur. Hence the Output is Stack overflow Error. And it is Tail recursion
@nandinisunkara40704 жыл бұрын
How is it tail? If the condition changes,It will be non-tail.
@rushikothari12614 жыл бұрын
@@nandinisunkara4070 Does 2nd printf Executed atleast 1 time ? Ans is No.. Therefore, programs are just like Pf() Recursive()
@tokomnyori67304 жыл бұрын
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.
@rushikothari12614 жыл бұрын
@@tokomnyori6730 In which data structure Integer are stored in Computer?
@indhujag59203 жыл бұрын
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.
@belwizdadimed39676 жыл бұрын
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().
@konstantinrebrov6756 жыл бұрын
use gcc -O2 to enable tail recursion in C.
@belwizdadimed39676 жыл бұрын
Konstantin Rebrov you didn't understand my point and hrnce you're responding to a question I didn't ask
@vaibhavshreenamdev83925 жыл бұрын
sir in homework problem there is a function called main( ),its not mentioned so where should i start execution ?? i'm confused....
@madugulajoshi50503 жыл бұрын
Same doubt
@006daredevil3 жыл бұрын
you have to assume any number and assume that fun2() function is called from main() function and passing a value to it.
@ashu31283 жыл бұрын
int main() { printf(''%d'',fun2(any number here)); }
@MuhammadNaveed_5110 ай бұрын
great job man
@april633823 жыл бұрын
hi, i want to ask question about the function in 08:49. I dont understand what the purpose of this function , for example, when n=4 the output:2, when n=3, the output:1. what are the meanings of the results? thank you.
@mohit68072 жыл бұрын
It's so silly of me to reply your comment because now you already know the answer but As 3/2=1.5 but it is an integer variable so it will ignore the values after the dicmal Hope you get it know 😜😜
@nuwaver913 жыл бұрын
Are they both Non Tail Recursive because printf is the last thing in the function?
@niteshmodi54683 жыл бұрын
Thanks for the lecture especially the tail recursion part which was very confusing for me..
@maksberlec48324 жыл бұрын
Both functions are non-tail. They all have printf after the function call.
@madhusudansahu54824 жыл бұрын
2nd is not a recursive program
@maksberlec48324 жыл бұрын
@@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
@anshikayadav78574 жыл бұрын
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.
@d_agudo4 жыл бұрын
thank you very much for this amazing video! helped me out!!
@saumyashrivastava305 жыл бұрын
Good video 👍
@rounakbiswas35906 жыл бұрын
Sir will you not update the videos in reasoning and aptitude Playlist?? You said there will be 250 videos but alas there are only 20. Thanking you in advance.
@saifahmedsunny4 жыл бұрын
Thankyou neso academy
@shikshitverma16844 жыл бұрын
Sir plesse give the answer of homework problem in the next video for satisfaction.
@yaxinee25 күн бұрын
Thank u that what i needed
@chitrangreddy64794 жыл бұрын
1 st one is non tail recursive and second one is tail recursive ...❤
@brocklesnarufcchamp14 жыл бұрын
How come the second one is tail recursive?
@anshiporwal26243 жыл бұрын
@@brocklesnarufcchamp1 perhaps there is nothing to evaluate after function calling they simply print n
@unknownfacts892910 ай бұрын
Both are non-tail recursive 😊
@DSAbyraj17293 жыл бұрын
thank you sir .well expalained
@engineer_b_a_b_u9 ай бұрын
@neso Academy Here void fun(int n) is void type then you're writing return statements. Is it not an error??
@andistheinforitbutso75133 жыл бұрын
Awesome 👌
@shanthiyasekar73174 жыл бұрын
First program is non tail recursive function and the second one is infinite