Hi, everyone.
So in this video, we will apply the recursion on Kripalani, so for example, if this is Michael A.B.C.,
so let's try to write a function print.
So this brain function will print ABC and we will also write one more function, reverse print.
So the output of REWASH print will be S.B.
So let's start the course for these two function, print and reverse print.
So what will the gold of print function?
So this is our area.
This is our.
I want to print this area.
So what I will do, I will print the first index.
So I will print AOF zero.
I will do very small work, so I will print this value and then I will apply to go on this Eddie so
recordation will print this, Eddie.
OK, so this is a very pleasant if this is a this is a blessing.
So now let us write the code.
So I just want to bring to the area so that it will be void, Brent.
I don't think it is, but let's say the name of that is in prudery.
So basically, this is basically when it is empty.
So if it is empty, that means in part of zero will be none.
So this is our best case.
So in this case, if I were in, that is basically empty, so we will not do anything, we will simply
return.
Otherwise what will do?
So I will do very small work.
So our plan is very simple, what we will do.
So I want to bring to this area.
I will bring the first element, so I will print off zero is basically the three, so here there is
input, so I will bring the first element and then I will apply the question.
The question will print this smaller.
So let me do my work.
So I just I will just print the first Trelew.
Let's simplify it like this and what will happen, the coalition will print everything else.
So let's call this function print and I will give the rest of that.
So I will give input plus one and my area will be printed simple.
So that is all that we need to do.
So let's call this function print.
Let's create a Barry.
So Eddys, ABC.
And it's called a function Brent and Bassendean prudery.
So output should be A.B.C..
So now is ABC, so our function is working, so I told you we will do two things so our brain function
is ready.
So what we do now, we will also write the code for reverse spend.
So let's discuss how we can write the code for replacement.
So basically right now, what I'm doing so in this case, what I'm doing when I am printing normal,
so first I am printing this value and then I am calling recursion.
So if I want to print, if I want to print in reverse order, if I want to print in reverse order,
what will I do?
First, I will print this, Harry.
So first I will print this Harry, and then I will print this value.
So basically the order will be reversed and everything myself.
So currently in this in normal printing, first printing, this element and then we are printing this,
Harry.
So we are printing normally, but in the reverse order print what we will do.
First of all, print this, Harry, and then we will print this element.
So basically our order of printing will be reversed.
So we just need to reverse the order of these two calls.
So let's create another function.
So this is void, letting a real function is reverse sprint.
Told Dick.
It is in this case will remain him, so let's copy this.
My guests will be him, and first we will call that equation.
So first print the rest of that done.
The function is reverse print.
So first print the rest of that and then print the current element.
So what I'm saying here is C. So what will happen this is already.
So I am standing here, so this element will say, do not bring to me if the rest of the area, so I
will come at this element.
So this element will say, do not bring to me first, bring the rest to daddy.
I will come at this element.
So this element will say, do not bring to me a footprint rest of the area.
So first you are bringing rest of the area and then we are bringing the current element.
So finally, at this point, you do not want to me for the rest of the area so that it does not exist.
So we will return.
So when we will be done now, we will bring this value.
So then we will bring this value, then we will bring this value and so on.
And at last we will print this value.
So let's take one example and let's build this school, so let's do it in first Discworld ABC.
So what will happen?
So first of all, this is my output.
So I will print it and I will call dedication NBC.
Now, I will bring to be and I will call for.
So now I will Bentzi and I will call the ABC and then so we have also so then we will call on the empty
Adonal.
So when you encounter Nylander done so we will return and we are not doing anything, so we will simply
return.
And this is the output A.B.C. So let's check for this, how it will work.
So let's take the same example, ABC.
And this is my output.
So what will happen, he will say, do not paint me first, paint the rest of the day, so I will call
on ABC.
We will say do not paint me for the rest of the 80s.
So I will call Nancy.
He will say, do not paint me for the rest of the area.
So I will call ONAL so we have none here.
So when we encounter Nael, we will return.
When we encounter we will return.
So when we are returning, after the election is over, we will bring the current Telemann.
So I will princi.
So when we will return, we will bring the current elements.
I will bring Debbie.
So when we are done, we are bringing the current elements of current element is so easily printed.
So that's how the output will be Seeb.
So this is a reverse print.
So let's test this also.
It's called the function reverse sprint.
And I will pass and put.
So let's give one timeline here so that we can see it clearly.
So let's call the function, let's say, an hour file.
So output is ABC and then we have c.B.
So that's how it is working.
So this is it from this video.
I will see you in the next one.