Recursion (Solved Problem 1)

preview_player
Показать описание
C Programming: Recursion (Solved Problem 1)
Topics discussed:
1) Solution of GATE 2015 problem on recursion.

Music:
Axol x Alex Skrindo - You [NCS Release]

#CProgrammingByNeso #CProgramming #Recursion
Рекомендации по теме
Комментарии
Автор

This que is so looking so interesting... For now I didn't get the concept... Will definitely return to this que after getting some more concept about recursion 🙂

ojaskumar
Автор

the tree makes sense but I cannot possibly understand the concept behind it. I'll come back to this when I'll have better knowledge

Hiyori___
Автор

Confused program changed to simple program through your explanation 👌

Karthik-orfy
Автор

Now I understood how multiple recursion works...
Thank you bro

gopinathsubramani
Автор

Now I understood how the gate questions be.

phani
Автор

After get(0) -->if(0<1)-->True-->return-->
control goes to
*get(1)*---->> then get(n-3)=get(-2) and then if(-2<1)-->True-->return to get(-2)
And then evaluate print(n)
n=1 hence will be printed..

Then control shifts to
then control will shift to
Then printf will get evaluated and hence will print
n=2
Then control shifts to

if(0<1)-->True-->return to get(0)
Evaluate printf
n=3

Now control transfers to

if(1<1)--->>False-->>Hence now
get(n-1) will evaluate.(note:n=1 for following statements)
-->>get(1-1)=get(0)-->>
if(0<1)-->return at get(1)-->now printf will evaluate and print n=1
n=1
Control will shift back to parent function i.e. get(4) hence it will print

n=4



Control shifts to

if(2<1)-->False--> get(n-1) will eval.
Now n=2, get(n-1)=get(1)-->
if(1<1)-->False-->return to get(2)-->>get(n-1)-->get(1)
And as get(1) evaluates printf will consider n=1
Hence n=1 will be printed
And control shifts to get(2) i.e.get(5-3)i.e.get(n-3)
Hence printf will evaluate
n=2.
Control will shift back to parent function
get(5)
Hence will print n=5
Same applicable for get(6)
n=1
n=2
n=3
n=6
O/p:-- 123141251236
I understood this much...still confused.
It will be more helpful if someone can elaborate it more in deapth ..🥰

krishpatil
Автор

Guys watch it again to understand..
And for if(n<1) we are checking false condition here like 6<1 is false then..5<1..4<1..3<1..2<1..1<1 => all these conditions are false thatswhy we will continue
And at the end 0<1 is true condition hence return.

MeteorSky
Автор

coming back in this question is really confusing. please explain more clearly and easily. I am really looking forward to it.

nikhilanand
Автор

This program is really very confusing..

radheshyamsingh
Автор

how is the condition is true when n=1 and if (n<1)? unless you forgot to write if (n<=1) so we can call then get(1) and get (0).

ahmed
Автор

Though your explanation is excellent, this question is quite confusing😅. I guess I will come back again after watching some more videos.

shravya
Автор

This problem is quite confusing ..I think 🤔 I need to watch it several times ...but ur way of explanation is pretty good

enjoylearning
Автор

this might be wrong, as when Get(1) is formed value of N is 2. and so on. sir please reply?

radheyshreeagrawal
Автор

Please suggest any book for such questions 🥺🥺🥺

abhaypratap
Автор

I didn't understand when to use gate(n-1) and when to use get(n-3) .Please help me.

pratikneupane
Автор

Hello, can you please make a vedio on space and time complexity in c

shahidmujawar
Автор

sir pls expaliN how the OUTPUT is printed :
o/p is::: 1 2 3 1 4 1 2 5 1 2 3 6
pls explain each one by one its really cant understand with out u!
Thanks for above wonderful simple explanation

anonymousindinymous
Автор

If( 1< 1 ), this condition is false so how get(0) is evaluated ?

bollyedits
Автор

How after get(-2) it goes back to get(1) and then to get(2) ??

rtm
Автор

could u plz make a video on how to guess the last part of recursive cuz teachers r making questions in exam which they give first part of recursive code and want us to write the other part.

digitalgoldmine-
visit shbcf.ru