background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Recursion | Recursion concept and problems | Lecture 27 | Java and DSA Course"

Download this video with UDL Client
installarrow down icon
  • Video mp4 HD+ with sound
  • Mp3 in the best quality
  • Any size files
"videoThumbnail Recursion | Recursion concept and problems | Lecture 27 | Java and DSA Course
play-icon
Table of contents
|

Table of contents

0:00
Introduction
1:30
Today's checklist
1:56
Recap
6:27
Today's checklist
7:06
Introduction to Recursive functions
8:00
PMI: Principle of Mathematical Induction
17:45
PROBLEM 01 : Print all natural numbers 1 to n using recursion.
26:02
PROBLEM 01 : Print all natural numbers 1 to n using recursion : Code.
28:40
Call Stack.
40:25
PROBLEM 01 : Print all natural numbers 1 to n using recursion : Dry Run.
52:35
PROBLEM 01 : Print all natural numbers 1 to n using recursion : Dry Run Summary.
55:55
Stack Overflow Error.
58:38
Halting Condition or Base Case.
1:01:43
Definition of Recursion.
1:06:00
The Recursion Spell.
1:10:53
Working of Recursive Function Syntax
1:12:26
PROBLEM 02 : Print all natural numbers n to 1 using recursion.
1:18:49
PROBLEM 02 : Print all natural numbers n to 1 using recursion. Code.
1:23:16
PROBLEM 02 : Print all natural numbers n to 1 using recursion. Dry Run.
1:30:47
Why do we need Recursion?
1:31:58
Summary
1:34:31
Next Lecture
Video tags
|

Video tags

recursion
recursion in Java
recursive function
recursion examples
recursion examples in Java
recursion explained
recursion program in Java
Java programming
Java programming basics
Java recursion
Java tutorial
Java for interview
dsa. physics wallah
working rule
problems
pw
pwskills
college wallah
cw
java
dsa
collegewallah
physicswallah
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:00
Hello everyone how are you guys I hope everyone
00:00:03
Great and I welcome you all to the lecture.
00:00:06
Off D Java Programming Series Launched By
00:00:08
P scales friend, today's lecture is on recognition.
00:00:11
Which is very special and important
00:00:14
Topic Today we are going to introduce Recon.
00:00:16
and you can understand that your recovery
00:00:19
This is your first intermediate topic
00:00:21
Beginner's Face to the Programming Journey
00:00:24
Transaction in an intermediate phase from
00:00:26
Will do whatever topics we have read till date
00:00:28
For Loop While Conditions in If Else Loops
00:00:31
Take the loop brother loop, we have developed all this stuff.
00:00:33
ok hey we have seen a data
00:00:36
We have read in the structure arrest you
00:00:37
We also made the questions of the Ares fact.
00:00:39
We still have a lot of questions about the arrest
00:00:41
We have solved it, friend.
00:00:43
What is usually done is to create logic and
00:00:45
To implement the logic we
00:00:47
This else and these loops usually these things
00:00:49
Our questions can be solved with the help of
00:00:51
Today we are going to learn a new tool.
00:00:53
The solution to our campus problems is
00:00:56
Today's topic will help in solving
00:00:57
It is special because neither
00:01:00
prekarshan in yourself you know recognizance
00:01:02
Will help in solving the problem now
00:01:04
Next we are going to read Lingle List
00:01:06
Back to studying dynamic programming
00:01:08
The graphs are going to be tracked ok
00:01:10
I will listen to some algorithm in all this
00:01:12
If he has to undergo surgery then you should understand that this
00:01:14
There will be pre-request to all those lecturers
00:01:16
This is why it is very important to understand
00:01:18
It is a topic so it is important that you
00:01:21
read it very carefully and at all
00:01:23
Don't skip, it's important.
00:01:25
This is where the whole story begins
00:01:27
ok so friend essentially today's lecture
00:01:30
We will introduce some regen in
00:01:32
Some working rules will solve the problem
00:01:34
ok so date is what i will do
00:01:37
In today's lecture and also come d se time
00:01:40
I want you to mentor some kids
00:01:42
Reconciliation seems a bit intimidating topic
00:01:44
Some kids have a bit of a butt.
00:01:47
It is not for once if you understand its basic
00:01:49
If you understand properly then you will get information about reservation.
00:01:51
No problem in solving problems
00:01:53
it's going to be okay
00:01:55
Lecture Let's recap our last lecture
00:01:58
What did I read in We are here in time space
00:02:00
Coming after studying complexity in previous lectures
00:02:02
Which was also a very important topic
00:02:04
This was also something that would remain sharp for you
00:02:07
With Every Time You'll Talk About Time's End
00:02:09
Space Complexity Any Question Any
00:02:11
You can pick up the topic after the interviews.
00:02:14
Take it and you will go into the industry.
00:02:16
Our focus will also be on time
00:02:18
By optimizing end space complexity
00:02:20
What are you saying? I hope it's okay, my friend.
00:02:21
You have understood the topics well on this
00:02:23
We have also solved questions and loops
00:02:25
Okay in the recap of Invested Loops
00:02:27
Friend, today I am going to tell you the timings face.
00:02:29
I won't give away too many details about Flick City.
00:02:31
Today I will give you a quick lesson in these facts.
00:02:35
Rev karaungi yaar by the way yaar I am sir
00:02:37
That you guys will remember Mathred Already
00:02:40
But for a quick revision we also once
00:02:42
Let's revise quickly because
00:02:44
The problems we will solve
00:02:46
When we are discussing about reconstruction then he
00:02:49
We are very clear about the method on time.
00:02:50
It is important to understand, okay
00:02:52
What are methoded? What are methoded and block off?
00:02:54
Court Which Are Executed When Called
00:02:57
Ok then you will write the method first then we will write it.
00:03:00
Write return type let's wide and if
00:03:03
Method wait is returning then white
00:03:05
means that the method returns nothing
00:03:07
After that we write the name of the method.
00:03:10
Print from Lets and give Sam ok from Lets
00:03:14
We are writing two methods simultaneously.
00:03:16
After that, we put round braces.
00:03:18
Round parenthesis and
00:03:21
In these parentheses we pass parameters
00:03:23
Do if any method receives parameters
00:03:25
If you are doing it then it's okay, I think we want it.
00:03:29
Let Sam receive A and B receive Sam's
00:03:31
If the definition is like this then we will give it here
00:03:33
You can write parameters to print anything
00:03:35
No need to receive, ok print immediately
00:03:37
Simple Method Without Receiving Anything
00:03:39
No, there will be something inside it then we will curl up.
00:03:41
Let's put braces, okay, let's end it, friend.
00:03:44
The part that comes here is called
00:03:46
I use this one from Third Body Method Body Letts.
00:03:48
Inside the method we are printing hello
00:03:52
South means friend, print means system
00:03:57
It is written, ok, I take it inside Sam.
00:04:00
We calculate the answer A + B Alright
00:04:03
Give an end and we will retain the answer.
00:04:06
Here is the return word I used
00:04:09
This is used to return a value from
00:04:12
D method is ok so essential answer is D
00:04:16
Thing date is being returned from D method
00:04:18
Sam now this is the return keyword this is this which
00:04:21
This is a written statement, it is optional, like this
00:04:24
In method whose return type is wide if
00:04:26
Should I write the return here or not?
00:04:30
It doesn't matter what this method is
00:04:32
Ok but if I write return here
00:04:34
Even then it will not make any difference but in terms of returns
00:04:36
We don't have to write anything further, just
00:04:38
It is okay to put a semi column before the return.
00:04:40
But in this method there is a wait
00:04:43
Was returning with this thing inside it
00:04:45
It was defined that it would wait for return
00:04:47
Returns statement is compulsory in that
00:04:49
ok now how to call a method man
00:04:52
welcome call me print
00:04:54
I will write to you in print.
00:04:57
I assume this is happening inside the method.
00:04:59
ok this is our method
00:05:04
And inside this I called print
00:05:06
Simple
00:05:15
Let's pass it here that brother you and
00:05:17
You calculate three and then we calculate one.
00:05:19
Will have to be received in reply, ok if we
00:05:22
whether we want to print it or
00:05:23
can do directly
00:05:29
One more thing to remember here is that
00:05:32
return statement is
00:05:34
Wherever you go in the method, it will be given a point.
00:05:37
Method execution completes
00:05:39
Okay, that method stops there.
00:05:41
ends there
00:05:47
There are many lines inside the method, this line
00:05:50
Van tu three four five do a lot of things like this
00:05:52
If the lines are written inside it then let's say
00:05:54
that if somewhere in between here returns 1
00:05:57
2 3 4 If anything is written in return then this
00:06:00
These are the lines below, man!
00:06:01
This method will not execute
00:06:04
Simply returned the van to this point
00:06:06
This line will run, this line will run, this one will run
00:06:08
Returns are coming, nothing beyond that.
00:06:10
So this one turn statement will work wherever
00:06:13
There goes the execution of the method
00:06:16
Complete mani goes ok next to that method
00:06:19
Date is also a thing that doesn't date you
00:06:23
Should know okay so date about that
00:06:26
Little Pre Request It Revision and Today's
00:06:29
Function by request in lecture
00:06:30
Will introduce some working rules
00:06:32
Will see this inshaalli of recursive functions
00:06:34
I will tell you two-three such steps
00:06:36
Which will help you a lot in recovery.
00:06:39
In understanding and two people understand that set off
00:06:41
Topic But I've Told You Already Keeps
00:06:44
Not if you understand the basic of it
00:06:47
Ok in today's lecture of Anil Mixer
00:06:50
coming
00:06:51
We solve so many problems in three-four lectures.
00:06:52
Solve what your fundamentals are
00:06:55
Get well, it's okay to take recogen and we
00:06:58
One or two problems also, friend, together on recension.
00:07:00
You must be doing witch are regional just you
00:07:03
Understand Research All Right
00:07:06
First of all, I am here to tell you just a little
00:07:08
I am going to give the definition of Rickson which is
00:07:11
There will also be infected incomplete definition
00:07:13
Which we will complete next one question
00:07:16
ok after solving it friend
00:07:18
Essentially regeneration occurs when a
00:07:21
method calls itself ok
00:07:23
You can write or function
00:07:26
Calling Itself Also Another Thing Yaar
00:07:30
We use these two words as function and method.
00:07:32
Interchangeable will be making him
00:07:40
We will understand in details now but later
00:07:43
called print within print
00:07:46
If someone does something like this then it will be called Rickson.
00:07:48
Don't worry about it this thing right now
00:07:50
We wrote this figure about it now we
00:07:52
Will understand properly further ok just a basic one
00:07:55
We have just written the definition here and now
00:07:58
Before we understand this in detail, one more
00:08:01
We are going to see the topic of Maths.
00:08:04
PM came for Principal of Mathematics induction
00:08:07
Because if we PM comes immediately
00:08:10
If we revise from then we will see some things which
00:08:12
Are
00:08:13
Will be able to relate to Rickson
00:08:16
Had you studied maths in your childhood?
00:08:19
If you haven't read then there is no problem.
00:08:21
It's not a problem friend, don't think that you
00:08:23
I won't understand the request anyway.
00:08:25
Just going to give an overview if you
00:08:27
I don't know the thing, it's completely
00:08:29
Fine we can understand logic if you do maths
00:08:32
It's okay if you don't have the same background.
00:08:34
I remember you haven't read the PM lecture.
00:08:36
No. Which class was I in if 11
00:08:39
Was in 12th and you are from maths background.
00:08:40
So don't worry about it me
00:08:43
Friend, we kept proving something in The Me.
00:08:46
Brother, you would have given us a formula.
00:08:48
Have and See Have You Proved the Formula True
00:08:50
Is for all numbers and even numbers for given
00:08:52
Numbers all right so some concept like this
00:08:54
It used to be that PM will come so for example today we
00:08:57
what are you proofing
00:08:59
Today we are proving that Sam of first
00:09:01
N natural numbers for any given number
00:09:08
all
00:09:12
Sigma Representative Sam Alright This
00:09:15
representative's brother
00:09:25
You are fine, this is the formula, Sam off.
00:09:29
This formula of first and natural numbers
00:09:30
We know this to be true but we don't have this proof.
00:09:33
We have to do this, this is right, okay friend, we are doing this
00:09:35
Cheese can also be written as Sam of N.
00:09:37
Sam of n we have studied functions in maths
00:09:40
Just like we would write 'D's brother F of X'
00:09:42
=
00:09:45
Sam of N = Sam of N + 1 / 2 F is just
00:09:49
You have replaced it with Sam. You write it as fun.
00:09:51
Okay, I just wrote Sam instead of F.
00:09:53
If given then its representation time is correct
00:09:55
Sam of n is initially equal to tu n of
00:09:58
n + 1 tu and this represent sum of
00:10:01
First n natural numbers which is inshaalli
00:10:03
This thing is ok so we have to prove it.
00:10:05
What do we do to prove this?
00:10:07
What is an assumption?
00:10:09
Take it as a proposal or hypothesis
00:10:12
And what was this ajmpetion?
00:10:15
The formula is this is true for even numbers
00:10:18
Okay, keep in mind we have to proof.
00:10:21
that for all natural numbers n will be the element
00:10:24
Value of Van A goes to 100 A to 200 A
00:10:26
This Formula Will Always Be Valid
00:10:28
We have to prove this, what are we ajmpetion?
00:10:30
are taking any number for which
00:10:32
This formula will be true so man this is
00:10:35
Avarshanvanshi will reach the size of
00:10:39
Sam K + K * K + 1 / 2 comes this injury
00:10:43
This is Sam of
00:10:45
So we have to prove this is ours
00:10:47
Assumption is now the ultimate thing
00:10:49
To prove, we need to prove two things.
00:10:52
If we want to do these two things
00:10:54
If you prove it then it will be proved that this
00:10:57
What is the formula? They look at two things.
00:10:59
Are
00:11:01
The first proof we have to do is that if Sam off
00:11:05
Cake of Sam which is k*k+1/2
00:11:08
If the sum of first natural numbers is correct then
00:11:11
Sam K of First K + 1 Natural Numbers
00:11:15
plus van ke plus tu by tu a will go fine
00:11:21
For whom have we made this thing true?
00:11:24
+ 1 This thing will be true for us
00:11:27
We have to prove the second proof, we have to do this
00:11:29
Is
00:11:31
Ki Sam of First Van Natural Number N Ki
00:11:36
value becomes van
00:11:54
Isn't it why this is visible because see
00:11:57
Sum of first n natural numbers
00:12:00
The formula is n * n + 1 / 2. Keep it aside.
00:12:03
It's okay if the value of n is one.
00:12:06
What answer will come from the formula? Will the van come ok?
00:12:09
So the answer was created from the formula and we know.
00:12:12
Hai's Sam of First Van Natural Number Van
00:12:16
If it happens then the van is already ready.
00:12:22
right hand side
00:12:26
By applying the formula 1 * 1 + 1 / 2
00:12:30
If you see, this formula is for vans.
00:12:32
If this thing is true then we can already prove it.
00:12:34
One of two things has happened, so we have to do one thing.
00:12:36
It is clearly visible in front of me, it is fine so
00:12:39
Friend, your claim is that if we both
00:12:41
Proof the thing and on this assumption
00:12:43
If you prove this then this formula is proof.
00:12:46
I will tell you why this is so.
00:12:48
I will give but we do the same in Me, it's okay
00:12:51
Let's take an ajmpetion and then one or two.
00:12:54
Give us more proof and let us say whatever we want.
00:12:55
I have the formula and I have proved it to you.
00:12:57
samjhaungi why are we saying this
00:12:59
By proving this thing our
00:13:02
Why has the formula been proved?
00:13:04
Let's proofread this van first.
00:13:05
Then you will understand that thing is right in the proof van.
00:13:08
What do we have to do to sum the numbers K + 1?
00:13:10
This has to be proved, now let's see once.
00:13:12
What is the sum of numbers Ki + 1?
00:13:15
See i = 1 to k plus van if i
00:13:18
If I am writing Sam then what will happen 1 + 2 + 3 +
00:13:23
such k plus k plus van
00:13:27
this happens
00:13:44
This is 1 + 2, now it was time till you, this thing
00:13:49
So what we have is that k is a + 1 / 2
00:13:52
So friend, what is this thing, it is not at all
00:13:56
and what is its value
00:13:59
So the first thing we want to know is this thing
00:14:03
to we
00:14:05
What can we write about sigma=12?
00:14:08
Are
00:14:09
The time of numbers is an obvious thing, isn't it?
00:14:12
If you use the first plus one natural numbers
00:14:14
Sam is coming out so the first one inside him
00:14:16
The part that is part of natural numbers
00:14:18
Will be close ok so friend CR
00:14:21
Calculating D Sum of First K Plus Van
00:14:24
The natural numbers within us are the natural numbers.
00:14:26
The numbers are visible here and one more thing is added to it.
00:14:29
We have to cap + 1 the value of this thing
00:14:31
We already know it is because we
00:14:34
he took the azmpetion ok so we take it
00:14:37
Can write kk+1/2
00:15:02
i = 1 to k plus van which is from here
00:15:06
Started calculating and reached here
00:15:08
So it's just k + 1 k + 2 / 2
00:15:14
Okay, now look here, prove it to us.
00:15:17
Was
00:15:18
The left hand side was this and the right hand side was
00:15:22
and this is our left hand side
00:15:25
The two equals we have brought are fine.
00:15:35
This is the formula for natural numbers
00:15:38
Let's see, it's a very simple thing
00:15:41
If we proofed it right for the van
00:15:44
If given, we will prove it right for you too.
00:15:46
can why because for if true
00:15:49
If so then this thing is true for k + 1
00:15:52
Is it true or not? Look, for whom was it true?
00:15:56
Man's true proof for k + 1
00:15:58
So if we brought true for the van
00:16:01
If we have taken the truth for the van then
00:16:04
They will bring the truth for you too, right?
00:16:08
If logic is true for you then
00:16:11
Went
00:16:16
So for five will be true So for five
00:16:19
There will be videos for sex because why
00:16:22
True for k + 1 if letro occurs
00:16:24
You can proof the essentials from here
00:16:27
This chain has started, it was this plus
00:16:30
There was van and then after that if M's is there then this
00:16:32
k + 1 then we can say that
00:16:36
We for van and van and for plus van
00:16:41
This assumption has been proved for
00:16:44
Above all this entire formula is all natural
00:16:46
True to the numbers, okay so friend, we
00:16:49
We have seen two or three things here.
00:16:51
Saw Assam, after that we saw someone or the other
00:16:54
self proof someone we proofed ourselves
00:17:02
It's okay to take a jmpetion of faith.
00:17:06
take it for granted
00:17:08
And one we have proved the base case, right?
00:17:10
If we don't proof the van then no one
00:17:13
It didn't make sense if this thing was in the van.
00:17:16
because you are not there
00:17:21
This was for and if it is true then it is for.
00:17:24
This is true for Plus van also
00:17:25
We have seen and proved ourselves
00:17:27
Okay, so here we have it inside the
00:17:30
Saw three things Azmpetion Self Work and one
00:17:34
You can also see these three things in Base Case Recon
00:17:37
You will find just this little bit of my understanding you as me.
00:17:40
The aim was to make you relate to Rickson a little.
00:17:42
You can do it with something you have already read.
00:17:45
Rakhi is ok ok ok yaar moving on you
00:17:47
Rickjan look friend Rickjan to understand us
00:17:50
Will use this question
00:17:51
and then do your calculation.
00:17:53
will complete the incomplete definition
00:17:55
General answer to any question of rekarshan
00:17:57
What do we have to do to solve it
00:17:59
We know all this from these questions
00:18:00
Will record All Right Sir Question
00:18:02
It is said that if we have to write a method then print
00:18:04
All natural numbers from van tu en ok
00:18:06
Using Records
00:18:23
are and whatever is
00:18:37
So in the output we should see 12345
00:18:40
Printed This Is D Question Now You
00:18:43
We will say, friend, this is very simple.
00:18:44
Simply set up a follow up which
00:18:48
will start
00:18:49
is and will continue till
00:18:52
And we go straight
00:19:06
Going to solve questions here
00:19:09
These balls are to be solved by reconnection.
00:19:11
I want to understand Rickson, okay so friend I have a
00:19:14
I reduce the sprint increasing function.
00:19:15
I write it down because again and again so much
00:19:18
If writing long will take a lot of time then man
00:19:20
Let's call the P function five passes
00:19:23
Karke so ye van tu three four five ye thing
00:19:26
print it ok call P
00:19:29
After passing for, it will print 1 2 3 4.
00:19:32
If we pass it three times similarly then this
00:19:35
Print 123 ok and if you pass then
00:19:38
van tu print
00:19:41
If you pass the van then print this now
00:19:45
It's ok to solve it, notice one thing
00:19:48
Do where we have written P four P four
00:19:53
Right if we carefully print increasing
00:19:56
If you look at five, there are three inside it.
00:19:58
four five a is a sub part inside it
00:20:00
Hai van tu three four vich is exactly d
00:20:03
P four from onwards ok so what can we do with this
00:20:06
Can this pf5 have this one inside it
00:20:09
Part
00:20:11
The thing is, every banana is valid, now you
00:20:14
see four p four me van tu three a
00:20:16
raha hai aur van tu three jo hai woh print
00:20:18
If the output of increase in three is P 4 P
00:20:21
Three and together four can be written like this
00:20:24
It's similar on aaye 3 ko pti tu aur saath saath
00:20:27
three can be written
00:20:30
That if I print increasing five
00:20:34
If you want to solve it then print it somehow.
00:20:36
Increasing four van tu three four output de
00:20:39
Give it to me and what should I do after that
00:20:41
Just print another five here and done man
00:20:43
Take this N is swissentali P of P of
00:20:46
n is so this infinite p n - 1 and n itself
00:20:50
It's okay if I write this together
00:20:53
If I go, my answer will come.
00:20:55
pi41234 will answer how will this happen?
00:20:58
It's just a method, isn't it? These two are different.
00:21:00
It's not a method, it's a different method.
00:21:03
P/4 different method han i know this
00:21:05
Both are not different methods, they are just
00:21:06
Values ​​are different, okay so essential
00:21:09
Like we did Adam in Me that brother for
00:21:12
We are adding the formula of the same number.
00:21:15
It was true that brother Sam of first
00:21:17
Natural numbers k + 1 / 2 is ok
00:21:19
So here also we will add that print
00:21:23
Increasing for or take the print of this
00:21:25
Increasing n - 1 gives the correct answer.
00:21:28
is if we print increasing i here
00:21:32
I will write directly, ok.
00:21:35
If you call N - 1 then it will come to N -
00:21:39
This will print all the numbers up to 1
00:21:42
we are doing assam
00:21:46
Don't worry at this point that I
00:21:49
What am I saying to the printed increasing?
00:21:50
So you haven't even implemented yet
00:21:52
So how will this thing print?
00:21:54
If this causes some confusion then at least a little.
00:21:56
What should we do? One thing we will do is this
00:21:58
Let's change the name to P, first we have the P method.
00:22:01
And by P method
00:22:05
Implemented ok n receiving
00:22:07
What we are zooming in on is that PN
00:22:10
- 1 will print the correct output look here
00:22:14
This is ajmpetion don't think too much about it
00:22:16
I wonder how this thing will happen, just take it for now
00:22:19
For this will happen I will show you
00:22:21
I will prove everything will be fine but right now
00:22:24
Let's say this thing is printed on n-1 numbers.
00:22:25
We have to think more than this.
00:22:27
No brother PN we have to solve and
00:22:30
We are Adaming the PN Mines Van that
00:22:32
Man, this is the output we should give.
00:22:36
Will give now see print increasing
00:22:37
What is reduced by the function is that whatever
00:22:39
Connected to the van till the value is passed
00:22:42
print all the numbers till then
00:22:43
If she gives then we took it as my heart that I heard
00:22:46
It'll happen right after it happens we'll have a
00:22:49
One more thing has to be done, see what will happen here
00:22:51
The numbers from n to n - 1 will be sprints but we
00:22:54
What to print? What is the goal of this method?
00:22:56
Sprinting all the numbers from WAN to N
00:22:58
Now the numbers from WAN to N-1 will be available from here.
00:23:01
are printed
00:23:03
But we will have to do one thing ourselves.
00:23:05
what is that thing ok to print n
00:23:09
So we did this thing ourselves
00:23:14
ok so if this thing is true then this
00:23:19
Will print n if n was five then 5
00:23:23
And if N is something else then our answer is A.
00:23:27
I want if this thing is true
00:23:30
One thing, one trouble, that trouble is that man
00:23:33
take it
00:23:35
What will happen if the value of N goes away?
00:23:39
The van will be received here and here
00:23:53
If it is an invalid input then what can we do if it is zero?
00:23:56
Will print means zero print from van
00:23:58
If you want to do this then it is not of this make.
00:23:59
So how come the van is giving such an issue
00:24:01
Because here it will not be possible to understand further that
00:24:03
What to print from one to zero?
00:24:05
There is nothing to be done, zero from the van
00:24:07
What happens is we have to buy the van separately
00:24:09
What can we do if we have to handle it?
00:24:11
We can write in the beginning that if
00:24:14
n1 is
00:24:18
so what should i do then what should be the output
00:24:21
If the end is made then only one print should be done.
00:24:22
If it should happen then we know then what can we do
00:24:24
Will print the van here myself
00:24:26
will give and return here in this
00:24:29
Will stop the execution of the third key here
00:24:31
What do returns mean by return key word?
00:24:33
If the statement of this method is given here
00:24:35
The execution will end here we are here
00:24:37
We will not come here, we will be third in this
00:24:40
gonna finish ok so p zero
00:24:43
There will be no such thing as CR.
00:24:46
Already we have started the van case.
00:24:49
I wrote it like this, its very important
00:24:51
Whatever it is, you will understand that there is only one
00:24:53
It is not his job to handle a case.
00:24:55
It's fine, it's more, but I still don't understand.
00:24:58
We wrote this thing for the sake of
00:25:00
case is called
00:25:02
We had also seen all these three things in m n =
00:25:06
Had proofed a base case for 1
00:25:08
ajmpetion and a self
00:25:12
But let me tell you what this code is
00:25:15
It's absolutely fine and it will work, it's fine and it's
00:25:17
Why will this work, how will this work, we are not sure yet
00:25:20
gonna understand now and before that once
00:25:23
Let's code this and run it.
00:25:25
Is this thing actually going on?
00:25:27
Brother, you printed a strange thing from the van.
00:25:31
There should be something above the five ajmpetion
00:25:33
Can you zoom in a bit like this on Assumption?
00:25:36
There's a little programming going on butt man
00:25:38
We have written here for you to understand
00:25:39
That we have made a resume now that we
00:25:41
We will understand how this program works.
00:25:44
If you are then you will see that this assumption which
00:25:46
This is actually all built up
00:25:48
The thing must be printing, okay, so we
00:25:51
You will understand the thing, wait for it, keep patience here
00:25:54
But just understand it a little at a high level, it's okay
00:25:56
As you can see, at a high level we have just understood
00:25:58
If this thing works then this thing will reduce
00:26:01
ok then print this
00:26:13
In class we have one method
00:26:16
We will take input from the user
00:26:20
For that we create an object of Scanner class
00:26:22
have to make
00:26:27
ok system.in
00:26:31
This is how we take input, so much we need now
00:26:33
reaches till
00:26:35
And in these we are taking input from the user.
00:26:39
Integer then we get print increasing
00:26:41
The method named is to be implemented.
00:26:59
And what will this return do, whatever?
00:27:01
If it will not return then its return type should be
00:27:03
Went
00:27:07
I am writing the same code here NK
00:27:10
Let's deal with it here that if n
00:27:12
the van is
00:27:17
Because the value of N is currently
00:27:31
Our Solution for An Equal Tu Van
00:27:34
be till here
00:27:36
What C Want We Solve for N - 1
00:27:40
Now want to do our Assumption
00:27:43
in a manner
00:27:44
This line will print this many things.
00:27:48
But what should be its output?
00:27:51
output should be
00:27:53
Something like this is fine, this much has been printed
00:27:56
But this thing was not printed so we
00:27:59
will print automatically print
00:28:01
It's okay to make a statement
00:28:04
Now let's try this, friend
00:28:20
will be printed by 10
00:28:28
I made a call, how are things going, okay?
00:28:32
Friend, first of all I will give you another copy of this code.
00:28:36
I want to explain something, actually revise.
00:28:38
Do you want to do it, we have discussed it before
00:28:40
but let us discuss it once again
00:28:42
because it is very important
00:28:44
To understand the rights we started the call
00:28:46
Do you remember how we discussed it brother?
00:28:48
Want method calls inside a stack
00:28:51
Stock is made to make room for local variables.
00:28:53
A frame is made for each method, isn't it?
00:28:56
We revise things quickly because
00:28:57
It is important to understand this, friend.
00:29:00
What have I done here?
00:29:02
Functions are maintained, four methods are maintained
00:29:03
Whose names are Fan Van Fan Tu Fan Three and
00:29:06
This is our method, okay public
00:29:08
It's start, okay, this is the fun-one third.
00:29:12
A local variable X is created inside it
00:29:14
and in the next line it calls the funtu method
00:29:16
I am doing fine with the photo method right now.
00:29:18
Let us see what it is and how to call Funtu method.
00:29:21
After this it is printing X in front
00:29:23
You have become a x, call that 1 3.
00:29:25
and is printing x
00:29:27
Then again in 1 3
00:29:30
This is being printed and we will drone it
00:29:31
And you will immediately understand that brother inside the call
00:29:34
How is space being created for method?
00:29:36
Matted going out how Matted in
00:29:38
Hey, it's okay friend, this is someone I am strange to.
00:29:41
Court has not written this is very normal
00:29:43
Good, I just changed the method call.
00:29:46
It is given here just to understand a little.
00:29:48
Okay, you are not confused in this
00:29:49
Is it true that the fan called you from the van?
00:29:51
Just called fan three from fantu
00:29:54
I have printed it, it's nothing, friend
00:29:56
Like we call this inside a method
00:29:58
Do you understand that we used the method?
00:30:00
Fun-one call, what can we do till now?
00:30:03
Here's the fun van, we wrote code inside it.
00:30:05
And what did we do this time? Another
00:30:07
method called inside it and which method
00:30:09
Called, another method call inside it
00:30:11
Some other method is happening inside the final method
00:30:12
Call is not going through, we have done this before also
00:30:14
Have you actually remembered us from Ares?
00:30:16
If you ask questions, we will get any question.
00:30:18
If it had to be solved with let's then inside that
00:30:20
Same thing if we write a print are method
00:30:22
The method is being called inside the method.
00:30:23
Is and I Separately Methoded
00:30:26
Just chain of tu method it is there tu three
00:30:29
Method OK when any program
00:30:31
If it is executed then it is our first
00:30:33
Loads into RAM and gives it memory
00:30:35
You get something or the other of different types
00:30:37
Memories He Gets Tags Memories Got
00:30:39
Got hit memory ok let's start today
00:30:41
I am going to talk about memory.
00:30:42
I have told you earlier also that we discuss this thing.
00:30:44
Have done local for free in the beginning
00:30:46
Third calls in variables are this thing
00:30:48
and objects are created in hip memory
00:30:50
Okay, today we will focus on start memory.
00:30:52
This is what the stack memory is going to do.
00:30:54
we're call start ok stack
00:30:56
Essentially a linear data structure
00:30:58
also happens to be ok data structure which is
00:31:01
LIFO follows the LIFO principle.
00:31:04
Principal means last in
00:31:06
first out
00:31:08
If I can give you a real life example
00:31:11
Let me explain to you the meaning of stack.
00:31:13
There is a yellow off plates stack off
00:31:16
There are plates, this is the first plate you have.
00:31:18
This is the second plate, this is the third plate, so if
00:31:20
If you see, what is needed to create this file?
00:31:22
must have been done see first first
00:31:25
The plate must have been placed on top of the first plate.
00:31:27
The second plate must have been placed above the second
00:31:30
Fourth over third and over third now if we
00:31:33
If we have to pick up the plates then the first thing we do is
00:31:36
The plates will rise, that will be the fourth plate, ok
00:31:37
Will you be the first to get up on the fourth plate?
00:31:41
It happened that the plate that went last was last in.
00:31:44
She is going out first, okay then her
00:31:47
After reading the topic, third plate, now
00:31:49
The third plate will not rise unless
00:31:52
The second plate will not rise until it rises.
00:31:54
It's okay so friend, you understood in the end
00:31:56
First out means the thing which is most important
00:31:58
She was inserted last and first.
00:32:01
The date that will come out is the meaning of last end.
00:32:03
We can't get anything out of the first middle
00:32:05
See whenever a method is called
00:32:08
Corresponding becomes a love call step
00:32:11
Watch this call from Let's Inside
00:32:14
Stack is this is called stack
00:32:22
So friend, whenever any method is called, call this
00:32:25
A stack frame will be formed inside the step.
00:32:27
Sawyer what will happen first see in java
00:32:29
If we run anything then first of all
00:32:31
When the method is run, first of all I
00:32:34
A stack frame will be made here only for
00:32:36
Extract frame will be fine for me
00:32:39
Step frame is nothing friend, we are just one
00:32:41
Giving different spaces. Giving different spaces.
00:32:43
If each method is fine then I am
00:32:45
Got this space for this stack frame
00:32:48
What's inside for the bunny?
00:32:51
Function van call is going fine.
00:32:52
Now look, we are here in the start frame.
00:32:55
Will track two things from the start frame
00:32:58
There are two things we are storing inside, okay
00:33:00
This frame is being stored, not us.
00:33:02
What if the tag is framing?
00:33:04
Two things first which are local variables for
00:33:07
Example Ye X = 1 Ye Wan Wan Key Stack
00:33:10
Who will be the second in the current line of the frame?
00:33:13
C is executing ok remember
00:33:15
will keep
00:33:16
Firstly local variables and secondly current
00:33:21
line which we are processing which
00:33:25
we are executing
00:33:30
yes
00:33:34
What
00:33:43
If the first line of this method is line number
00:33:46
in the van
00:33:49
Now see whenever a method is called ok
00:33:52
remember this we are doing it
00:33:55
We are doing this further also that whenever someone
00:33:57
When a method is called, it is called
00:33:59
Corresponding creates a new stag frame
00:34:02
Okay, so if there is a fan van call then it is called fan van.
00:34:05
A new stag frame will be made for ok now fan
00:34:08
Fans go to the van, first row in the van
00:34:10
The value of
00:34:12
X is being created and it is getting value.
00:34:14
Van to yaar yahan pe x = 1 line number
00:34:16
There is a queue at the van again, you are there again friend
00:34:19
Line three is ok give me line tu par hum aaye
00:34:21
What's going on on the line, man? One method.
00:34:24
I am calling fan, are you ok?
00:34:28
Now this fun method is inside it.
00:34:30
What's going on? First of all, if it's Fantu.
00:34:32
If the call has come then a new stag for Fantu
00:34:34
If the frame is made then first it will be for Fantu.
00:34:36
Make a stack frame and one more thing this fan
00:34:40
Van ne fan van ne fan tu which line pe
00:34:42
I have called you on the line number
00:34:44
ejeniously right now on line number tu
00:34:46
Processing is going on inside the function van
00:34:48
ok so here is your line number
00:34:51
The reference will be stored as brother's line number.
00:34:52
tu is where the function tu is called ok
00:34:54
Hai function tu call ho hai to hum function
00:34:56
going to tu and giving a value to x
00:34:59
Here we are creating a new variable
00:35:02
There is X and you are giving value to it.
00:35:03
Okay, remember one thing, this one
00:35:06
This one is different
00:35:08
We read about scope of variables, right?
00:35:10
We read method levels in that thing
00:35:12
We have already read so here's one more
00:35:15
The new variable became x = 2, both of these things
00:35:17
are different because method levels
00:35:19
Variables are different only
00:35:21
This and this are different in name.
00:35:23
They are made on different dresses
00:35:25
Variables are there only in name ok so this
00:35:28
X Equal Tu Tu This Was Line Number Van
00:35:31
ok line number van let's go give line number
00:35:33
Another method call is happening in you 13
00:35:35
Because the method is being called then a new
00:35:38
Start frame will be created ok a new stag
00:35:41
Where did the frame come from and how did it come together?
00:35:44
method call line number tu se to that thing here
00:35:48
but it was stored fine
00:35:50
Now it's call 13 so let's go to fun three
00:35:53
will have to
00:35:55
look at one more thing friend
00:35:57
If inside the van you called fan three
00:36:00
If you have done this then first you 13 will complete this
00:36:03
Line number three jo hai na fan tu ki line
00:36:07
Number three can't work unless it
00:36:11
The line number is not complete and the line
00:36:13
number tu make method call is switch method hes
00:36:16
you are complete
00:36:54
If it has happened then he will be the first one to come out and until
00:36:57
the function doesn't work, you don't
00:37:00
Yaar function tu till function tu nahi
00:37:03
Function vans cannot come out until it comes out
00:37:05
All right now look at function three man what?
00:37:07
Another variable is being created in function 3.
00:37:10
is x
00:37:12
Whose value we are giving three is ok
00:37:17
This line number is on the van, now its line
00:37:20
number tu pe kya hua print ho gaya x
00:37:22
ok let's print x here
00:37:25
We will write the output as the value of our
00:37:27
What is this function in this frame?
00:37:30
If the value of x is three then here
00:37:32
X printed and give write very good
00:37:35
We reached the end of the method when we
00:37:37
What does it mean to reach the end? What is the method?
00:37:39
Method's execution completed
00:37:41
Execution completed means what?
00:37:43
The stack frame will now be removed, okay?
00:37:46
The state frame will be removed from here.
00:37:48
Cheese Function Three Key Stack Frame Cow and
00:37:51
The flow will return to the function.
00:37:54
Because the function is now at the top of the call stack.
00:37:56
Where is the function in tu?
00:37:58
Come back, see what we have in the line store.
00:38:00
The significance of what was done was that
00:38:03
Where to get that thing back from the store line
00:38:05
You will know the line number, ok.
00:38:08
There was a method call in the line number tu
00:38:11
That has been completed so now we can move forward
00:38:14
ok what's happening in the next line
00:38:17
X is currently being printed
00:38:19
See what the value is here.
00:38:22
See here the value of
00:38:24
Yes, it's X friend, you will be printed, okay
00:38:26
Line number three also worked, after that this method
00:38:29
its execution is over ok
00:38:31
The agency is over, we have come to an end, meaning
00:38:34
Finished execution, now this thing which is
00:38:36
Function tu jo hai woh bhi removed from stack
00:38:41
It's okay, this thing will disappear from the call stack.
00:38:44
Gone and where will the flow go from us now
00:38:46
See the flow which is function tu se function van
00:38:49
Where will I go in the function van?
00:38:52
Function van mein line tu pe kyunki line
00:38:55
The function was called on you, are you ok?
00:38:57
man there is only one function call in this
00:38:59
So this line has been executed
00:39:00
We will come after the function is completed
00:39:02
On line number three where X is printed
00:39:05
everything is fine
00:39:08
from van so x printed ok its
00:39:10
After this method is also completed, we
00:39:12
This can also be removed from the stock frame
00:39:15
So man, this also got removed from the staff frame.
00:39:17
And its flow also moved to the next frame.
00:39:19
ok now what is read stack frame
00:39:21
Now I have learned my method, my friend.
00:39:24
Which line to go to in the method
00:39:26
go back to the line van one in the line van
00:39:29
Fan van call was going on that call should be completed
00:39:31
is done, then after that we can remove it also.
00:39:34
Can this anxili friend of ours be empty
00:39:36
We have completed the entire execution.
00:39:39
And our output is this, okay this
00:39:41
From the example you were supposed to understand that Stag
00:39:43
When do these methods go into the frame? Okay, when
00:39:46
When calls are also made this method within which
00:39:48
Go and when does Kabir get removed?
00:39:50
Occurs when execution of function
00:39:52
Now the function is completed
00:39:54
Execution completes either
00:39:56
We will definitely reach the end
00:39:58
The closing curly bracket appears or
00:39:59
If we see the returns statement somewhere
00:40:02
Take us man returns somewhere in the middle
00:40:03
If we see the statement then we will point it out also.
00:40:05
By removing the function from the stock frame
00:40:08
Will give curly brackets important for us
00:40:09
It is not important for us
00:40:11
Function ended at execution point
00:40:13
when is he returning ok or this
00:40:16
We will consider it as return on point or
00:40:18
Then if xplicatively there is a return somewhere
00:40:20
So we will remove him from us at the point.
00:40:23
I hope you have understood this thing about Tri Hope.
00:40:25
Okay friend, now we are ready for this actual
00:40:28
ok let's dry end the code
00:40:31
Let's start we have a print
00:40:33
Increasing method has an if condition
00:40:36
If it becomes true then we print
00:40:37
And return this return
00:40:40
Anciently this function
00:40:41
Will end execution, nothing further
00:40:44
Will run and this method will return from where
00:40:47
This call took place there and after that
00:40:49
Both lines are fine, they will work only when
00:40:51
This condition is not true, ok this one
00:40:53
The condition is not true, actually it is fine here
00:40:55
There is a method call and then there is a print.
00:40:58
Dry end of method calls is fine
00:41:00
How does this happen inside the call step?
00:41:02
To understand, we just took that small
00:41:04
I saw the example. Okay, let's make it.
00:41:07
Have your call step
00:41:09
this is ours
00:41:24
We have enough lines for reference.
00:41:26
Six Line Seven Such Man has been fine
00:41:28
First of all, this method call is
00:41:31
Where did this call come from?
00:41:34
Is it too late for us to call you?
00:41:36
So we have a small method here
00:41:38
let's write like
00:41:39
Called from brother and for time being
00:41:43
We create N=4 by ourselves without taking input from the user.
00:41:48
Ok let's write and we have to call.
00:41:51
I am writing this in print increase P.
00:41:53
in short
00:41:54
And what about these 1000 things we have inside love?
00:42:05
will print 1234
00:42:13
N is not van because n4 is passed
00:42:16
Then we have called this method from
00:42:20
This is the same method, just pay the value of n for
00:42:22
Given value of n is n - 1 then this
00:42:24
inshaalli we have given four ok
00:42:32
n - 1 correct reduce which will reduce it
00:42:36
What is needed and print increasing method
00:42:38
Whatever parameter is passed should be reduced.
00:42:41
If you print it on the outside of the van then
00:42:44
This van according to our expectations
00:42:47
Will print three, we don't know how
00:42:49
We will just see who will print it.
00:42:52
We did high level thinking okay
00:42:54
We are going to verify that now, okay?
00:42:57
This will print 1 2 3 and this will print four
00:42:59
will print as the value of n is
00:43:02
Ok
00:43:03
1234 should be printed next
00:43:07
I have written the line on the space here
00:43:09
Gave
00:43:17
How is this high level thinking?
00:43:20
How is the truth, okay so friend, first of all
00:43:24
When a method is called, the stack for
00:43:27
frame will be made
00:43:29
Ok
00:44:02
remember one thing
00:44:22
When we pass parameters while calling a method
00:44:25
If we pass arguments then their
00:44:28
A copy is made, I don't actually have it.
00:44:30
Had it been there, a copy of this N would have been made and here
00:44:33
But within that copy this four which is copy
00:44:36
Four value must have been copied, okay?
00:44:38
So the value of N being formed here
00:44:41
There is four but this and and this and are
00:44:45
Different, we will see more Anas being made in future also.
00:44:47
We are going to be different from them
00:44:50
Copy by name only, pass by value
00:44:53
This is ok, I hope you understand it.
00:44:55
You have value nearby.
00:44:57
I have seen the reference lecture, ok so
00:45:00
Coming back tu line number van of this method
00:45:03
Here we are checking whether n1 is
00:45:06
no man n4 so we have nothing here
00:45:08
We will go straight to line number five
00:45:10
We will go to line number five and
00:45:13
There is a method call on line number five.
00:45:15
ok and print what method is being called
00:45:18
Method call is coming from increasing agency itself
00:45:20
Okay, so the step frame is also for P.
00:45:24
Will be made again for this P but this N
00:45:27
Look what's nearby from here n - 1
00:45:31
and what value of n
00:45:40
it's three
00:45:51
If it is not true then it is okay then we will go straight.
00:45:55
came on line number five
00:46:00
In which n - 1 is passing what is n
00:46:03
Currently there are 3 so what will be the pass?
00:46:06
No because 3 - 1 so from here we
00:46:09
then went back here okay
00:46:16
Why would you be an antivirus for that?
00:46:19
here you receive voice bar ok like now
00:46:22
Friend, we had seen earlier also that till the top
00:46:24
Wally stag frame is not completed
00:46:27
call taxi till the staff below him
00:46:30
Whatever is supposed to happen on the frame does not happen.
00:46:31
Neither will the one above go away.
00:46:34
We won't go down now we drank n = 2
00:46:36
and if you notice
00:46:39
Let us also write this thing here.
00:46:40
Did we start from Hai Four or here
00:46:43
Of Actually I Called Four
00:46:47
And P4 called PS3 P
00:46:51
Three called you so now we are in this p
00:46:54
You are executing your call.
00:46:57
This condition is not true even for a call
00:46:58
If yes then we will go to line number five
00:47:00
There's a method call again on line number five.
00:47:04
Method call does not mean start frame
00:47:07
made a new start film
00:47:11
What will happen
00:48:22
it will flow now
00:48:25
The stock frame that will be lying on top
00:48:40
will remove
00:48:42
Correct
00:48:46
have to come back
00:48:52
When will it come down that we have stored the line number?
00:48:54
got it done
00:48:57
There was only a call which has been completed so now
00:49:00
we will come
00:49:06
Which stag frame are we in?
00:49:09
Function Hall We are here and N's here
00:49:13
If value is tu then it will be printed now
00:49:18
You are right, it is printed here, you are ok.
00:49:24
Our line seven after you're printed
00:49:27
Pay
00:49:28
Which is close in bracket which is mains
00:49:36
The tax frame will be removed, so this is ok.
00:49:40
The item was also removed from the stack frame.
00:49:44
Okay, now where will the flow go, whatever starts?
00:49:48
Whoever calls this P2
00:49:51
did ok print increasing call
00:49:55
Did it with argument parameters you ok
00:49:58
Alright now we are back on this call
00:50:04
This is the call to the increasing three. This is the call.
00:50:06
This one is complete. This one is complete.
00:50:08
Here A is here, the value of N is
00:50:16
Six pe n is being printed
00:50:22
it's printed
00:50:25
Okay, the function came on line seven.
00:50:27
Execution ends and its removal from the stack.
00:50:29
it will happen it will happen
00:50:32
And where has the slow gone now?
00:50:42
I have to go to the line at five, it's okay.
00:50:46
What is the process on line six
00:51:00
[Appreciation]
00:51:06
complete
00:51:12
it is done
00:51:32
How come ok coming back tu line number
00:51:36
six four this function
00:51:53
Now this start has been removed from love
00:52:00
have control
00:52:05
pay line 2 pay yaar ye method call hua tha witch
00:52:09
Hajj has already been executed so now we
00:52:11
If I have reached the end then I should also be removed.
00:52:14
will go from the call stack ok so si have
00:52:16
Completed execution and now we stop
00:52:19
will go and when we stop our output
00:52:23
There van tu three four a chuka hai so
00:52:24
Essentially, this is the ajmpetion we took.
00:52:26
Ki Bhai P3 Jo Hai P Three Wo Van Tu Three
00:52:29
Will print in actual 1 2 3
00:52:31
print and then we have four
00:52:33
printed on if i dry this
00:52:36
what happened to calls in ejentalian
00:52:40
So look what happened, we did it first.
00:52:42
Called four out of four Called three out of four
00:52:45
You have called from three and you have called from
00:52:47
Have called van now 1 why first of all
00:52:49
Printed Look at the calls we made
00:52:52
This call has gone inside the step and the call stack
00:52:55
LIFO structure is followed inside
00:52:57
The last in first out thing is the best.
00:52:59
First
00:53:00
The calls have been made in this order, the first four
00:53:03
Then there is the one of three, then there is the one of you.
00:53:05
Then there is the van one and the thing which we
00:53:07
The witch wants to do that thing by printing that thing.
00:53:10
First for the one who is highest in the stack
00:53:13
The top was fine and the top van in the stag
00:53:16
So the printing for the van was done from here.
00:53:18
ok we didn't call zero because
00:53:21
We didn't need to make zero calls
00:53:22
ok we get zero because no print
00:53:25
Had to do it right when this thing is over
00:53:27
When I went, it was removed from the stage and we
00:53:29
You went up and 2 but when we came, friend you
00:53:33
Make that call, this was the P2 call.
00:53:35
P1 van call ended here
00:53:38
It happened for you when we return to this function.
00:53:41
Aaye P2 pe to hum line six pe tu ko
00:53:44
ok we have printed it in this order
00:53:47
Printing done so last in first out
00:53:50
What was the reason for the calls being made in this order also?
00:53:51
But the printing is last day first.
00:53:54
If it is in the out order then it is fine.
00:53:55
in the last
00:54:01
Because of this this happened, now you will think that friend
00:54:04
Well, so much brain to write this code.
00:54:05
It will have to be said that brother, last in first out.
00:54:07
For what will come out in the end and
00:54:09
How will this dry iron, floor etc.
00:54:11
Where are you going, don't you have such a mind?
00:54:14
I won't have to put it in at all.
00:54:16
I will tell you in a very simple way how to do this
00:54:19
We can write code, ok at a high level
00:54:22
We have to think and understand these things
00:54:25
And it is not necessary that we have internal knowledge.
00:54:28
What's going on and we're just high
00:54:29
I am also doing level thinking.
00:54:31
I am going to show you how to do high level thinking.
00:54:32
What about it and how will we write the court?
00:54:35
Will you think about how to write this brother?
00:54:37
Okay, before that friend one or two things and first
00:54:39
The thing that we have stopped at n=1 is very
00:54:44
It was necessary for this program if we
00:54:46
If you don't write code our code will not run.
00:54:47
No, don't pretend that we didn't write this line.
00:54:50
What if it had happened? Let's assume you haven't.
00:54:53
Retain it this van se pe hai zero gaal hua
00:54:56
We got here from here, okay now at zero
00:55:01
Will come here again ok
00:55:22
The stack frame we just created
00:55:24
Look inside, what college was Piya's call?
00:55:27
C was for all p i n = 4 p then 3
00:55:30
For tha p for you was for tha p for van
00:55:34
Then what would have happened if this thing was not written?
00:55:37
For zero, one more is formed on top of it.
00:55:42
Take the mines van and then you become another mine.
00:55:45
For then mines three for mines four
00:55:46
This process never stops for
00:55:50
Do you understand that we never make returns?
00:55:54
What would happen to our entire stock?
00:55:57
Hey man this call makes me overflow
00:55:59
He is stark because of the stag he has.
00:56:01
It has limited memory so that you
00:56:03
How much will the group keep filling here?
00:56:06
Stack overflow will happen
00:56:10
Let me show you my code.
00:56:12
These lines go back to the condition
00:56:14
the one to check
00:56:17
we remove what we are doing
00:56:20
For now let's see what happens
00:56:23
It is not true that 2 3 4 will be printed because
00:56:25
We did not manage the van no no
00:56:27
Because you see, I just told you
00:56:29
Showed that brother van se zero zero se mines
00:56:32
Van is becoming like this so you should be careful
00:56:35
See if I am giving five inputs.
00:56:37
The output should appear at 1 2 3 4 5.
00:56:40
what is happening
00:56:43
an error occurred
00:56:58
Because we are never stopping
00:57:01
Return
00:57:04
Now we will see here also the method
00:57:07
print increase
00:57:13
So let's fix this first
00:57:16
We have understood that this if condition
00:57:18
It was necessary to write this, now my friend, this is the condition.
00:57:21
The star that saves us
00:57:24
hurts us ultimate
00:57:30
See what Rickson is, you still know this.
00:57:32
It is understood that a function which itself
00:57:36
If you are going to call then we are doing recension only.
00:57:38
And if we don't write this thing then
00:57:40
We start searching infinitely
00:57:43
Ok
00:57:45
And this infinity protects us from reconnection.
00:57:48
Type of condition is fine. Special feature of this condition
00:57:51
What is the matter
00:57:56
whose answer we knew, whose answer we knew
00:58:01
We didn't have to do anything to make it.
00:58:04
Abhi and samjhaungi don't worry about this thing
00:58:07
Because this condition has stopped us
00:58:11
By going to Infinity Recon
00:58:14
Holding condition is also called ok
00:58:18
Take holding condition or base case
00:58:21
take it like
00:58:28
Answer: We have written that brother N = 1, N =
00:58:32
2 for 1 doesn't require much thinking.
00:58:33
Had to print not just one line, one van
00:58:37
Had to print something here 2 3 4
00:58:39
If we had, we would have to print all 2 3 4.
00:58:42
If it seems so, then the question is the same.
00:58:43
But it is a very small case at n = 1.
00:58:47
That's why this thing is also called base case.
00:58:49
That brother, a very small case whose answer
00:58:52
We know very easy, easy for van
00:58:56
Knew one thing was to print a van.
00:58:59
So he did all that and other things too
00:59:01
What has happened to us that we
00:59:03
It's okay if you are not going to Infinity Recon.
00:59:06
what we did we read the term here a base
00:59:09
We will call this case, we will name it as base case.
00:59:13
This is the second thing that we have done here
00:59:16
Making Another Call Farewell Smaller Argument
00:59:28
If we print it then we have van tu en ki
00:59:31
What a small problem, brother, you are here.
00:59:34
It's okay if Mines Van gets printed.
00:59:37
For smaller problems you can do this or
00:59:41
You can solve all the problems with this
00:59:43
Problem
00:59:44
Word's brother, is this all a problem or what?
00:59:48
smallers now problem or smaller problem
00:59:50
Ok again for this question
00:59:53
Let us understand that if we print 1 2 5
00:59:57
I had to do it okay
01:00:00
So what is a smaller version of printing 125?
01:00:03
It may be possible that we buy a van instead of 125.
01:00:07
If you print three or four then it's ok.
01:00:09
Smaller problem gone ok ok this was the second one
01:00:14
Thing, the third thing that we did was, brother, let's go.
01:00:17
A smaller problem has become a smaller problem.
01:00:19
So much has been reduced from this but one less thing has been left out.
01:00:24
Five confident that N's value will be good
01:00:26
If 5 is there then the van will make 5 confident.
01:00:29
If we did this ourselves in front of you three four
01:00:32
This thing is called self work I hope
01:00:36
You understood this, three things in one
01:00:38
holding condition base caseli which is that
01:00:42
Is the smallest value whose answer is quite
01:00:45
The answer to N=1 is quite obvious.
01:00:48
And it is quite small and simple, we have here
01:00:49
Wrote it directly on or
01:00:51
Also called halting condition because it
01:00:53
Let us go into infinite rekarshan
01:00:55
Saves exactly the second thing we saw Smaller
01:00:58
Is all the problem a small problem which
01:01:01
If we solve it, we will get help.
01:01:03
To solve our big problem
01:01:06
I will do some self work right after that.
01:01:08
Small problem solved but something left
01:01:11
There must be something left, so whatever is left
01:01:14
What has happened, we call it self work.
01:01:16
So date by the way this question one or two more things
01:01:20
ok holding condition we have already read
01:01:23
Now friend, as I told you,
01:01:26
I will tell you something that will make you
01:01:29
You won't have to think so much about the stack.
01:01:32
What could be happening inside? How are all these calls happening?
01:01:35
If this is happening then what code should we write?
01:01:37
We don't have to think when you ask questions
01:01:39
We don't have to think about sitting down to do this.
01:01:41
Let's see what we have to think about next.
01:01:44
Before increasing, we must complete our reconstruction.
01:01:48
Ok we meet the definition
01:01:50
saw
01:01:52
is recombined
01:01:54
function
01:01:59
Calling Itself
01:02:05
what is that
01:02:08
doing
01:02:10
See, if there was n here then n should be - 1.
01:02:13
If you go, you will generally get only this from us:
01:02:16
We may not be passing any parameters
01:02:18
Must be passing different parameters so with
01:02:21
Different parameters
01:02:31
and and what
01:02:34
end holding condition
01:02:59
We can do recovery when we have problems
01:03:01
What did we notice while solving?
01:03:03
While solving this problem we all
01:03:06
I have created a problem, it's okay
01:03:09
so what do we do in rekarshan
01:03:15
Performance is that function calling
01:03:22
To write it properly inside it we
01:03:25
What are we doing, this is that edition, now we are in this
01:03:28
what do you do in recovery
01:03:45
Smaller Sub Problem
01:04:01
Look what we're doing this guy
01:04:03
Our functions are our problems.
01:04:06
Representing in terms of functions
01:04:08
ok brother print increasing
01:04:13
Ok, this was the problem, we fixed it.
01:04:16
written in function form and all that
01:04:19
there is a problem
01:04:23
What was that Piya N - 1
01:04:30
function calls
01:04:36
self
01:04:44
you solve
01:04:47
It's all problem
01:04:53
So if
01:04:56
If the problem was PN then all the problems
01:05:01
It is different for us, friend, that is on the question.
01:05:04
Depends on this particular problem
01:05:06
What are all these problems that we face very soon?
01:05:09
We will ask all different types of questions.
01:05:11
Brother, we will see all the problems in this question.
01:05:13
What is causing all the problems, okay?
01:05:15
Nine Let's See How We Change Our Thinking
01:05:19
Will channelize any problem
01:05:21
ok to solve, see now this much
01:05:24
You will not think that this type of
01:05:26
What will be happening inside, which thing will come first?
01:05:28
What goes in, what comes out, all this
01:05:31
we don't have to think
01:05:32
Reconcile in a much easier way
01:05:34
The problem will be solved if you dry it.
01:05:36
And if you are scared after seeing it then you should hate it.
01:05:38
Just relax because we are a big
01:05:40
We are going to look at this simple thing
01:05:42
Will divide the process like this and understand
01:05:45
We will take the logic of any question
01:05:48
Will be able to make it easily, ok, I am that.
01:05:50
I am talking about it, friend, we are on a high level.
01:05:52
We need to think about not going too deep.
01:05:55
What will happen inside the stack etc.
01:05:57
Will think at level and how to do it
01:05:58
I will tell you that right now, okay friend?
01:06:01
I channelized these three
01:06:05
to the steps
01:06:07
rikjan spell
01:06:13
How should we think about our
01:06:16
If the problem is easily solved then
01:06:18
Man, what should we do first when we
01:06:20
A problem has to be solved by reconnection.
01:06:22
So the first thing we have to do is
01:06:25
IDENTIFYING D SMALLER PROBLEM OKAY
01:06:28
Like in this case the smaller problem was N -
01:06:31
To print numbers up to 1, this
01:06:34
Identifying this big problem
01:06:36
What's the problem?
01:06:39
The problem is ok and once you
01:06:42
identify the problem
01:06:45
So he solved all his problems with logic.
01:06:48
to do
01:06:51
Call method from with all problems
01:06:54
View parameters and that
01:07:06
this step
01:07:13
Here you have to put the information about Rickson which you are talking about in Rickson.
01:07:17
We are sending it to solve that problem.
01:07:19
Will solve it and bring it ok when we have PN
01:07:22
- If 1 is written then do not doubt that it is from the van.
01:07:26
Will print numbers up to mines van or
01:07:28
No trust it completely because here
01:07:30
If you start thinking about stocks etc.
01:07:33
You may get confused trust this
01:07:35
Thing's it's right right again this is high
01:07:39
level thought but i have shown you that
01:07:41
Why is this correct? How does this stack and dry?
01:07:44
And all this is happening last in first out
01:07:46
I have shown you high level thinking
01:07:48
Saying again and again
01:07:50
because that's what kids do
01:07:53
Get confused about things like stack etc.
01:07:55
You should understand and understand the stack thing.
01:07:57
While thinking, while making logic, we need to
01:07:59
don't think about it ok logic
01:08:01
While making we only solve smaller problems
01:08:03
Will focus and believe that recovery
01:08:05
correct answer
01:08:08
If you think about all the problems, you half understand them.
01:08:10
Your question is now solved.
01:08:12
Many of your questions got solved if
01:08:14
You have thought of all the problems, okay?
01:08:16
Because look what's left after that
01:08:18
After that only self work remains.
01:08:22
Self work means doing your own work
01:08:26
See Rickson doesn't give you everything
01:08:28
That's just solving a smaller problem.
01:08:31
Is he doing one after the smaller problem?
01:08:34
The part that remains is for us to do ourselves.
01:08:36
like in our example
01:08:38
Smaller problem printed 1 2 3 4
01:08:41
tha five we had to print it ourselves so this which
01:08:43
1 2 3 4 Had to print, this was recension work
01:08:46
Your brother will tell this to Rickson.
01:08:48
I brought this self that had to print five.
01:08:51
Work was fine, we need some helpers of our own.
01:08:54
We will have to do it okay as PM came.
01:08:57
The ajmpetion gem for n = 2 was and n =
01:09:00
I did the proof myself for K+1, right?
01:09:02
In this way we will be left with one cell work.
01:09:06
Even if you don't relate to me
01:09:08
There is no tension here, forget it.
01:09:10
This thing of hope makes sense to him.
01:09:12
I am making one thing after 1 2 3 4.
01:09:14
So all that remains is for us to print it ourselves.
01:09:17
Ok one more thing to do buddy
01:09:19
important base
01:09:22
How is the base? Do we need a base case?
01:09:25
Have to identify and in every question
01:09:28
You will have to see the base case, friend.
01:09:30
What is the base for this then identify the base
01:09:33
Case
01:09:37
what happens
01:10:00
So we will overflow the stock
01:10:05
Take care of the fine and small things
01:10:09
In case it happens, I am leaving a note here.
01:10:11
And on this note I will give you the next question.
01:10:14
I will show you in writing after explaining.
01:10:17
Ok
01:10:18
What do we have to think at a high level when we
01:10:22
Also want to solve any problem with Recon
01:10:24
At first there are smaller problems, so what?
01:10:27
The problem needs to be solved which is a big problem
01:10:29
Please help me to solve it then
01:10:30
After solving smaller sub problems
01:10:33
There must be something less, what is that less to us?
01:10:38
want to see
01:10:39
Third thing and very important
01:10:46
Once done, your code is written.
01:10:52
no problem
01:10:57
Working of recursive function is usually known as
01:11:00
Let's see in Rickson, ok then next.
01:11:02
Before asking question, see this also once.
01:11:04
Let's see, usually the method name is
01:11:06
ok and n parameters we passed
01:11:08
are in this question as we have just
01:11:10
One parameter was passed these 10 multiples
01:11:12
Parameters may also depend upon
01:11:14
D question followed by base case first
01:11:16
Condition is written basically here
01:11:19
I will write the base case first.
01:11:21
It is written ok and this is me with this
01:11:23
Why did I write this in the beginning?
01:11:25
The thing is, see if I start it
01:11:28
If you had written this at the end instead of writing
01:11:31
He should have done less, he would have done this less.
01:11:33
No why because man if let's say n
01:11:35
If the value van had come then this line would have worked.
01:11:37
This line would also have gone last
01:11:39
What happened after checking in that we
01:11:42
Had to stop not P0 call but P0 call
01:11:44
That's why the waste condition is there.
01:11:47
If it is written in the beginning then it is ok
01:11:49
Base Case A Method Called After Base Case
01:11:52
Basic Reconciliation
01:11:57
I am writing a request for this thing
01:12:04
Our less here we have that thing in the syntax
01:12:07
Sulfur quality was not shown because it was
01:12:08
It is different for questions, so here
01:12:10
We have shown it directly, so it's okay.
01:12:12
These three things we need on recursive work cell
01:12:14
Meaning, understand that when you have been made a mistake
01:12:17
Jae nahi hai fill in de blanks aur
01:12:19
What are the blanks of basecase research?
01:12:21
You will fill these with work and self-work.
01:12:24
ok let's do the next question now
01:12:27
The question is which program you write?
01:12:29
Print all natural numbers from n21 using
01:12:32
With Recon iteration we can do one
01:12:34
Will put loop which starts from N and till Van
01:12:36
Will work and keep printing i which
01:12:38
Our right hand is variable but we have to
01:12:40
Hydration is not to be done, it is not to be done
01:12:42
We have to print from Rekarshan
01:12:43
Means Function Calling Itself and We
01:12:46
What do you generally do? Everyone looks for problems.
01:12:49
If it's a small problem then let's deal with it first.
01:12:50
We will write the problem statement problem
01:12:52
what is statement we have to write a function
01:12:54
print decreasing i short it
01:12:56
I am writing this generation here, whatever
01:12:58
Value should be passed let's pass it 5
01:13:00
If I did this then I would start with five.
01:13:04
Will sprint all the numbers till the main and
01:13:06
In the input we write the condition 'Yaar N'
01:13:08
Greater give equal tu van aayega not zero
01:13:10
Input will come anytime and quite often. What happens?
01:13:12
This is my friend's interview and you have this condition.
01:13:15
He doesn't give or she gives janpujhkar this
01:13:18
Are you trying to check something?
01:13:20
noticing something like this
01:13:22
There should be a condition and this condition did not happen
01:13:24
So the invalid is important and told you
01:13:26
If it is invalid input then you are
01:13:28
If you handle it then you will face this condition
01:13:30
You can handle it only when there is input.
01:13:32
Can and print d
01:13:35
importance not valid ok super we have this
01:13:37
I have bought a bigger import than a van.
01:13:39
Will you get it or will you get it equal to a van, ok?
01:13:41
So coming back you de question now our jo
01:13:43
The problem statement is that
01:13:45
Brother, let him pass any number n.
01:13:49
So this is the kind of printing that we need.
01:13:52
If you bring it and bring it, then there is no problem for it.
01:13:54
What could be the small problem?
01:13:56
Maybe, let's see for this, friend, if
01:13:59
Me
01:14:00
If anyone wants to print 54321 for me
01:14:03
Print 4321 and bring it, it's ok.
01:14:06
Someone print this thing for me.
01:14:09
If you can print my recension and bring it.
01:14:13
So there will be very little left for me
01:14:16
printing five
01:14:20
Ok
01:14:21
man this is that record
01:14:28
does
01:14:32
So man n - numbers from 1 to 1 what method call
01:14:37
will print
01:14:48
So his expectation would be that from n - 1
01:14:51
Will spring the number till 1 ok
01:15:00
That's what it is nothing but term n - 1 and
01:15:04
What is this is an only
01:15:31
Witch Was Pad And Mines Van And Here
01:15:43
have to call
01:15:48
In the previous question we did recursive work.
01:15:51
Did it first and did self work later
01:15:54
It was okay so it was a smaller problem so we
01:15:56
Figured out we've seen three steps
01:15:59
What things should we do right now?
01:16:01
If there is a smaller problem then we figure it out
01:16:04
Please bring the answer of N-1, that is ours.
01:16:07
Smaller problem is the second thing we need is the figure.
01:16:09
Have to figure out what to do as self work
01:16:11
We have also figured out that we are
01:16:15
This is our print
01:16:20
the third thing left one
01:16:24
A case for which we obviously have an answer
01:16:27
Do you know which one it is?
01:16:31
The smallest input is our obvious one.
01:16:34
There will be a case whose answer we know pd1
01:16:37
The answer is very simple, the answer to PD1 is only van.
01:16:39
So let's keep N = 1 as the base case.
01:16:42
When N builds we will send the van directly
01:16:45
will print and what will happen when we
01:16:48
This record will only be calling calls
01:16:51
Let's say something like this
01:16:53
If value goes to you 4 A then four to three
01:16:55
There will be a call at 3. There will be a call at 2.
01:16:59
You print us on the seven and even on the van.
01:17:03
We don't even have to go further than that van and
01:17:04
We also know the answer of van, it is ok.
01:17:07
To calculate the answer we basically
01:17:09
p0 is not needed, the answer is four.
01:17:12
I need three to calculate
01:17:14
To calculate the answer to thi three I
01:17:16
I needed you to calculate your answer.
01:17:18
I needed a van but the van
01:17:20
To calculate the answer we need zero
01:17:23
There is no need, that's why I say this again and again
01:17:25
I am wondering which is the case whose answer is
01:17:27
It is very obvious for which we need no explanation.
01:17:30
If we don't solve all the problems then we will get van
01:17:32
Any other solution to find the answer?
01:17:35
The problem that does not have to be solved is Pad Van
01:17:37
To find the answer we need another smaller
01:17:40
We don't have to solve the problem pd0
01:17:42
There is no need to solve the answer
01:17:44
We know it directly and the answer is
01:17:46
If it is ok to print directly to WAN then this
01:17:49
our base case is someone else our base case
01:17:51
Why was it not because to solve step 4
01:17:53
We needed Generation Three's answer to
01:17:56
until three which is 3 2 1 prints
01:17:59
Till then Hum Four is basically the answer to Hum Four.
01:18:03
Will not be able to get out till then but the van will not let it go
01:18:06
Depend on other respect call ok so
01:18:09
That is why it is important to remember that
01:18:12
We are looking for a problem whose answer
01:18:14
It is obvious that we need someone to get out of it.
01:18:17
To solve smaller sub problems
01:18:19
No need, okay let's have all three things.
01:18:23
It's sorted, okay now let's go and do it.
01:18:26
Now you can write the code, see any type
01:18:29
I was thinking of using any dry iron.
01:18:30
Prethought or any last in first
01:18:32
Didn't you think about three small things?
01:18:35
list and we can think very easily
01:18:37
In some questions, they have to think a little too much.
01:18:39
It is not always the case that
01:18:41
But if we change our thinking in this way
01:18:43
If we channelize then obviously we will become a butter.
01:18:46
Will be in condition till final solution
01:18:48
ok upon arrival let's move tu d code
01:18:51
Friend, I will do this method.
01:18:53
I am a mess friend, some kids say that new
01:18:56
Write it in the file, not the code, but I hope.
01:18:59
By doing this you will not get confused and infected
01:19:01
Similar code should be written in the file if
01:19:04
So that's more butter practice
01:19:07
OK then
01:19:09
print decreasing we will write here
01:19:16
But here there are only two methods
01:19:20
Okay so I have to receive this and it's okay and
01:19:24
See Have You Called This Print Decreasing
01:19:26
from har
01:19:31
And this has to be passed and at the same time we
01:19:33
print increasing comment
01:19:34
Ok
01:19:36
Three things, first of all
01:19:55
If you forget then it's okay then they say
01:19:59
Friend, why is this stock and flora coming?
01:20:00
We have written the base case from the base case if
01:20:03
If you don't return then stack overflow will happen.
01:20:05
Why didn't she return it? Step frame
01:20:07
removed ok
01:20:10
Two things and one is self work and one is
01:20:17
Which one should we do first?
01:20:22
Watch us go to higher levels again
01:20:24
over here
01:20:28
321
01:20:31
work is that 4321
01:20:35
Printing but solving smaller problems
01:20:39
Before printing 4321
01:20:43
we have to print five four three you
01:20:46
Don't do it after van, this answer is needed a little
01:20:50
Four, three, one, five, this answer is not required.
01:20:52
ok we need
01:20:54
54321 So here's high level thinking again
01:20:57
Brother, before the smaller problem
01:21:00
If we have to do self work then self work is this
01:21:03
will be in the case first
01:21:05
Okay, what else is silver?
01:21:10
to print
01:21:28
and let's see
01:21:38
so everything is fine
01:21:51
Self work we requested ourselves
01:21:54
The work for which we have been hired
01:21:57
Trust me, you are absolutely fine here.
01:21:59
Don't get confused, be absolutely confident that this
01:22:01
The line is written and exactly on this line
01:22:03
Confident believe that it is n - 1 to
01:22:07
Will print all the numbers right up to the van
01:22:11
And it must have been printed on N.
01:22:13
If we look in this order n print
01:22:15
Will be from here and from here n - 1 to 1
01:22:17
It will be printed till now friend you any one of you
01:22:21
Any record, just write the code, ok
01:22:23
You will have to write these three in the same manner.
01:22:27
You will have to write these three parts every
01:22:29
let's see in the code
01:22:32
This is our base how if I print
01:22:34
going back to the increasing one
01:22:35
I am showing you three things in it
01:22:37
basecase
01:22:39
recursive work
01:22:43
And finally self work
01:22:48
Ok
01:22:53
In decreasing and increasing we
01:22:56
Recursive work was done earlier and self work
01:22:58
we did it later ok
01:23:02
So come on friend, let's dragon this too
01:23:04
Because we just made a new record
01:23:08
should be done and understand how
01:23:12
Going call methoded in call start
01:23:15
coming out ok so we have
01:23:17
print decreasing method which is in any
01:23:19
I must have called from, now we don't write
01:23:21
Now we have understood that the call from
01:23:23
Okay, so this is our call stack.
01:23:29
The first one made in stock frame
01:23:32
Will be on one line from right and main
01:23:35
print decreasing call must have occurred and it
01:23:37
Someone must have passed and will take four again.
01:23:40
are ok
01:23:44
And our expected output is
01:23:47
4321 and the output we are getting is
01:23:50
Ok we will write here this is D stack
01:23:53
frame for print decreasing print
01:23:59
Received four, condition check is fine
01:24:02
If the condition spreads then we will go straight to this
01:24:05
Let's go to the line, let's go to the line number once.
01:24:07
let's write quickly
01:24:14
Okay, so we went straight to line number five.
01:24:16
Another method call right on line number five.
01:24:18
There is no line number in the previous question
01:24:21
Third quality in five, line number here
01:24:23
Method call on five is not here pay line
01:24:25
N is being printed on number five, ok
01:24:27
what is n at the moment four is straight straight
01:24:30
It will be printed ok it is printed now
01:24:33
Hey we are on line number six, look at the line
01:24:35
Method call on number six ok so method
01:24:40
If there is a call then step cream will be made
01:24:43
And what is the value of N for that?
01:24:49
first of all i
01:24:53
P four called ok
01:25:05
So here goes man three now are we next
01:25:07
Tell me one thing when we P4 guys will go to the line
01:25:10
Method is on and this call happened here P3
01:25:14
So should we understand that the P4 method is over?
01:25:17
Went because here is the next line, right?
01:25:19
dude the next line is on the next line which method
01:25:22
This call is ending on l7 so we
01:25:25
If we do this then we will not be able to end the P4 call.
01:25:30
This call will not be removed from the status right now
01:25:35
Until that call ends
01:25:38
The call doesn't return anything.
01:25:40
Okay, it's wide anyway.
01:25:44
Will not return value but this
01:25:45
inshaalli this call does not end in itself
01:25:49
This call will not be removed until you leave.
01:25:52
Right now we are still on 96 lines.
01:25:57
What we have created here is fine
01:26:04
So we went straight from here to here this time
01:26:09
end key value
01:26:14
On the line pipe we printed N
01:26:17
print
01:26:25
Method call is with value n - 1
01:26:30
so b
01:26:34
for whom
01:26:40
We will not go to Thing L7 again for now.
01:26:43
Standing on the El Six Here we are from the El Six
01:26:47
call this one
01:26:49
have done
01:26:51
It's okay so come back here now
01:26:54
Are
01:26:56
print decreasing and what value got
01:26:58
This condition is still not true line
01:27:01
Printed 5 pe aaye tu because here
01:27:03
But the value of n is
01:27:06
Calling another method on line six
01:27:09
2 - 1 is un van ok so p d n = 1
01:27:16
And now we will start with the line van, okay
01:27:19
from here to here again
01:27:21
print decreasing value of n received
01:27:24
Hui and line van pe n's value van check
01:27:27
hui kya and wan hai han ji is n1 this time
01:27:30
So what are you printing the van with?
01:27:34
are printing n and n's
01:27:36
what is the value the van is the same
01:27:39
So what are you doing after printing it?
01:27:41
Are Return is ok, return means stay here.
01:27:46
Its execution, its story is over now
01:27:49
Will be removed from stack frame ok
01:27:56
It flowed here and came back here.
01:28:01
On call of pe print decreasing n = 2
01:28:04
ok on the call here the call was made
01:28:07
Nothing happened from PD1 means this Anjali is someone else
01:28:11
The call did not go through and we went back to Generation Tu.
01:28:14
Okay, after doing this, come back from here.
01:28:17
And which line to return to in that line?
01:28:20
Number Six Pay Line What's in Number Six
01:28:22
A method is happening in line number six
01:28:24
The call was actually made using that method call pad van
01:28:27
Yes but it's just a method call and nothing else.
01:28:29
So this line is over, okay now we
01:28:33
We will come, watch carefully from the line, now we have come.
01:28:36
Hai line 7 pe puri tu ki to pad tu wali
01:28:39
The start frame will now be removed because its
01:28:42
The execution is now over, of course we
01:28:45
Last line which is its last line actually
01:28:47
I don't have TV, the last line is this, it's okay
01:28:50
We reached D earlier but now we are on this line.
01:28:52
If you come, don't think that this thing comes first.
01:28:55
It was over here children are confused
01:28:56
That's why we go, tell us again and again about this matter.
01:28:58
I am doing this thing wrong that last
01:29:00
Only then the tax frame is reached
01:29:02
Removed does not happen when in actual
01:29:04
You can pay this closing bracket or return
01:29:07
It ends when we reach, okay so
01:29:09
Now this will also be removed from the start frame.
01:29:12
And where will she go back?
01:29:15
Method College on l6 in n = 3 which
01:29:20
I just came back here after finishing the finals.
01:29:22
We have received returns from here
01:29:26
Coming back ok ok back on the line
01:29:30
Must come
01:29:32
Call completed go to next line ok
01:29:36
If the method ends on the next line
01:29:39
Delete this from the stack and delete this too.
01:29:42
two you guys will go
01:29:45
Whatever Call Statement of Baroda
01:29:54
ok so from the call stack it's over
01:29:57
This start frame will now be removed.
01:29:59
Where is the flow of control right after the step?
01:30:02
swollen penis
01:30:05
Pe a went right in the inside essentially
01:30:08
There was only one call which has been completed
01:30:10
And I am also in the last bracket.
01:30:13
Friend, if we reach here then this thing will also end.
01:30:15
Okay, so the date is when I call.
01:30:18
Start bikams mat end all of de things all
01:30:21
Of de method to be process is inshaalli
01:30:25
Mains is that there was only one method call.
01:30:27
Multiple calls inside, all that stuff is over now
01:30:29
End and final output date is done.
01:30:31
Have
01:30:34
Definitely matches with the expected
01:30:36
Output is ok ok so date brings tu di
01:30:40
End of This Lecture Almost Finished
01:30:43
First I would like to talk to you about a few more things
01:30:46
Important Lastly, this question might be for you.
01:30:49
It might have come to mind a couple of times that Rickson's
01:30:51
What is the need? What do you need? Reconciliation when
01:30:54
We will print van tu end from hydration
01:30:55
Can print n21 from our trasn
01:30:58
If we can then why are we doing regen?
01:31:00
Look at all this, this is not a very simple question.
01:31:02
These questions affect what we have done
01:31:04
This is the one and only concept of Rickson.
01:31:08
To understand the D was ok their M was not
01:31:10
Very famous problems of any research
01:31:12
Is this or are there many other problems?
01:31:14
It was from Rickson just to understand the concept.
01:31:17
You will face many complex problems later on.
01:31:19
which can be solved very easily
01:31:21
Friend, see what happens due to precaution.
01:31:24
We just made it into three things, right?
01:31:27
Brother problem and base's more self work
01:31:31
By writing with this thing, when we
01:31:34
Actually if you write in court then code
01:31:38
Well, it was a small question too.
01:31:40
But such big codes will go ahead which if
01:31:43
If you write through recanon then it will be very small
01:31:46
So to simplify this code
01:31:49
To easily build logic in
01:31:50
Our efforts in implementing
01:31:52
Helps a lot that's why we vikarshan
01:31:55
We are studying, that's why we need revision.
01:31:57
ok so dat brings me tu de summary
01:31:59
Of lecture we saw recursive functions in this
01:32:02
inshaalli and i will tell you in a fun way
01:32:04
I will try to revise a little today
01:32:06
The final conclusion of what we taught you, friend.
01:32:09
And the final summary is those three things are okay
01:32:12
The record we saw was only spelled
01:32:14
We will see three things inside it, that is what we
01:32:16
Remember, before today's lecture, iron
01:32:19
advantages
01:32:23
All problem or all problem
01:32:27
I took it out, but believe me, it's okay.
01:32:30
Just take the record Leap of Faith which
01:32:33
You have called Rickson, she will reduce it.
01:32:36
Okay there, in case of stack etc.
01:32:39
Don't worry there, just believe that this
01:32:42
The thing will reduce as if believed on PN - 1
01:32:46
tha key print increasing n - 1 1 to n -
01:32:49
He will print till 1 with confidence and nothing further.
01:32:52
Think about it and take this recursive lip off.
01:32:55
After Identifying a Smaller Problem
01:32:57
Okay, now this smaller problem should be solved.
01:32:59
This is what happens, this is the step, okay we are ahead
01:33:02
gonna cause a lot of problems
01:33:03
In which we talk about the problem
01:33:05
Wondering what all its problems could be
01:33:07
Is it or what are its problems? Today's case
01:33:09
All the problems are right in front of us.
01:33:11
It looked okay so date this van thing of his
01:33:14
After this, friend, you will do something less yourself too, right?
01:33:17
my work
01:33:19
self work
01:33:21
What is your responsibility, if anything less?
01:33:24
You have to do it yourself and in fact
01:33:35
be less first
01:33:39
This is something we have to identify, okay?
01:33:43
Which one has to be first because print
01:33:45
Which happened first in increasing
01:33:47
Ricarder first in printed increasing
01:33:48
The one was self and was printed later
01:33:50
Decreasing has self and first
01:33:52
If research was done later, we would know about this also.
01:33:54
Keep in mind, friend, which one comes first?
01:33:56
We have to do it, okay, not by doing silver.
01:33:58
Have seen that less before the writ
01:34:00
To be or our less is to be first next
01:34:02
Thing and very important
01:34:19
We come across such cases very often.
01:34:22
Base cases are seen not every time but general
01:34:24
In base cases we see something like this
01:34:26
10 small numbers go ok if the numbers
01:34:29
The question is, ok, so next one.
01:34:32
In lecture we will talk about finding factorials.
01:34:34
Question will be done without nh3 and
01:34:36
I am here to tell you what happened in today's lecture.
01:34:38
This is what we have learned about reconstruction.
01:34:41
It was just an introduction to Rickson, you understand.
01:34:43
Lee was just a teacher now trailer and movie
01:34:46
So all that remains is for us to practice well.
01:34:47
Both of Rickson's are about date end
01:34:49
It is possible that in this lecture you may learn something
01:34:51
At points you felt like what if
01:34:53
You should see that point again.
01:34:55
So wherever there is problem in the video,
01:34:57
Watch it again and you will understand.
01:34:59
ok also do van thing whatever we did
01:35:02
You have dried those dyrence by yourself
01:35:04
Do it on copy pen, ok, write the code.
01:35:07
Run more important today's lecture
01:35:10
Are you directing them from you yourself?
01:35:12
do from
01:35:14
Make stag calls and see which one they are from.
01:35:16
This is what you do for today's lecture.
01:35:18
Okay date was all for today's lecture nine
01:35:22
Basic understanding for you today
01:35:25
I met Rickson as I said today.
01:35:28
So we have just introduced Rickson.
01:35:30
Deep knowledge of recovery by solving problems
01:35:32
And what is there in the introduction?
01:35:34
This is a simple step in the precaution.
01:35:37
The definition is simply that you are calling the function.
01:35:39
It's self we just did it in those three steps
01:35:41
Divided that we have no records of
01:35:43
If we look at the problem we will see three things
01:35:44
I will think that you will face further problems
01:35:47
karaungi in it we can do it in these three steps only
01:35:49
You must be sitting and thinking about them and finally
01:35:51
Very important thing is when you think logically
01:35:53
If you are living then you have to think at a high level and
01:35:56
Dry On and These Joe Call Stocks' Calls
01:35:59
We need to understand this because
01:36:01
How are they reducing things internally?
01:36:04
If we have confidence that from within we
01:36:06
If you also know how it is happening then it is better.
01:36:08
remains okay and if we ever think something wrong
01:36:11
If you are there then we should go to the lower level and see.
01:36:13
Can also read many ok present when
01:36:15
If we think logically then we will be at such a high level
01:36:17
Will think that brother smaller problem self
01:36:19
Work and base case is fine and will trust
01:36:21
Rekarshan, what kind of thing is this, this relationship?
01:36:24
Ours will be sold only on trust with Recon.
01:36:27
We are as particular as him on one line
01:36:29
Will trust and not the smaller problem which
01:36:31
It will be solved that easy for us.
01:36:32
We will have to think about these problems, okay thank you
01:36:35
You for watching this video aage un gentle
01:36:38
Reminder: You go to skills.com website
01:36:41
Lecturers' Notes Assignments and Upcoming
01:36:44
You can access the schedule of lecturers
01:36:46
And all of this is absolutely free of
01:36:49
Cost and I would highly recommend you
01:36:51
Lecturers must solve assignments
01:36:54
But it's more
01:36:56
Important Items Very Important Equal
01:36:59
You should also solve important assignments.
01:37:01
You will get a very good grip on the concepts and
01:37:04
Mastery will be achieved if you practice questions.
01:37:07
Will also keep solving and if any of your
01:37:09
Doubts remain related to the assignment or
01:37:12
If related to lecture then in description
01:37:14
You can fill the given form &c
01:37:17
Will CD form and whatever relevant out
01:37:20
C Will Pick Dem You And Address Dem In The
01:37:23
Upcoming Live Doubt Resolution Sessions Date
01:37:27
C Will Conduct So Thank You Again And
01:37:29
Happy coding bye

Description:

Recursion is the first step we take towards the intermediate programming journey. In this lecture manvi ma'am will introduce us to what and why recursion? Later we shall look into the analogy of recursion considering PMI. We shall solve multiple problems, look into the code and also discuss the common error being encountered while solving problems using recursion. Ready for it ? See you in the class then ! If you are facing any trouble accessing the assignment or lesson plan, please re-login to your account on PW Skills website and try. Are you finding the classes helpful? Stay tuned for more! Access the notes and assignments for this class for free at : If you are joining us late, to know more about PWSkills & plans : Watch the Orientation Video: https://www.youtube.com/watch?v=YpNFgTKVAtU Watch the Launch Video: https://www.youtube.com/watch?v=si8TKULKmLE Timestamps:- 00:00 Introduction 01:30 Today's checklist 01:56 Recap 06:27 Today's checklist 07:06 Introduction to Recursive functions 08:00 PMI: Principle of Mathematical Induction 17:45 PROBLEM 01 : Print all natural numbers 1 to n using recursion. 26:02 PROBLEM 01 : Print all natural numbers 1 to n using recursion : Code. 28:40 Call Stack. 40:25 PROBLEM 01 : Print all natural numbers 1 to n using recursion : Dry Run. 52:35 PROBLEM 01 : Print all natural numbers 1 to n using recursion : Dry Run Summary. 55:55 Stack Overflow Error. 58:38 Halting Condition or Base Case. 01:01:43 Definition of Recursion. 01:06:00 The Recursion Spell. 01:10:53 Working of Recursive Function Syntax 01:12:26 PROBLEM 02 : Print all natural numbers n to 1 using recursion. 01:18:49 PROBLEM 02 : Print all natural numbers n to 1 using recursion. Code. 01:23:16 PROBLEM 02 : Print all natural numbers n to 1 using recursion. Dry Run. 01:30:47 Why do we need Recursion? 01:31:58 Summary 01:34:31 Next Lecture ▶️ PW Skills Website - https://pwskills.com/ ▶️ PW Skills Instagram - https://www.facebook.com/unsupportedbrowser ▶️ PW Skills LinkedIn Channel - https://www.linkedin.com/in/pw-skills-136050249/ ▶️ PW Skills Telegram Channel- https://t.me/SkillsPW

Mediafile available in formats

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Recursion | Recursion concept and problems | Lecture 27 | Java and DSA Course" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Recursion | Recursion concept and problems | Lecture 27 | Java and DSA Course" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Recursion | Recursion concept and problems | Lecture 27 | Java and DSA Course" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Recursion | Recursion concept and problems | Lecture 27 | Java and DSA Course" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Recursion | Recursion concept and problems | Lecture 27 | Java and DSA Course"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Recursion | Recursion concept and problems | Lecture 27 | Java and DSA Course"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.

Follow our social media for updates