Recursion is a programming technique where a function calls itself to solve problems, with the call stack maintaining state through function frames that return to their caller upon completion. For validating a Binary Search Tree (BST), one effective approach is to perform an in-order traversal (left-root-right) and verify that the resulting sequence is sorted in ascending order, as a valid BST must produce a sorted sequence when traversed in this manner.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
{S30} Sep2025 Intro to recursion and Validate BSTAdded:
Hello everybody. Let's start today. Uh today we are going to start with recussion. Uh the first problem that we'll be doing is validate BSV.
So what's a BSC? Firstly getting into the anybody how do you define a BST?
got them.
It's a binary search tree wherein we divide the array into half.
We um divide the search space into half and every time we >> um iterate we try to reduce the search by half and try to sort it sort out the >> anybody else that's a good start.
>> What is the BST?
>> The left side elements are smaller than right side. left the left side elements are smaller than the root. All right, everybody google find out what is BST.
At this level you should be knowing more about BST or just read the problem. That was enough for knowing about BSC.
Are you sh What's a BST?
>> Um, sorry. That's what I'm I'm trying to read towards >> Neil, can you help with BSP?
>> Yeah. So as far as I could uh I know like all the nodes for every node uh left uh side of the node should be lesser than the uh node itself and the right side of the node.
>> Yeah.
>> The node or greater than the root. Yeah.
>> Okay. And one more important point left this doesn't complete the BST.
One more thing about BST is what?
>> No duplicate values. No duplicate values.
What? One more.
>> It should be a complete complete binary tree.
>> It doesn't need to be a complete binary tree.
>> Google it.
>> Just just Google it. Complete BST is a complete BST. I've never said that. It's a complete two notes.
>> Less than less than or equal to boot.
>> Left and right with uh should also be BST.
left three and right sub when when we have no duplicates then there this should not be there. Now that if we if we are either should this should not be there or this should not be there. If you're saying equality equality can be there then you are uh you're conflicting with the other statement.
>> All right. Somebody was somebody was saying that equal to uh if it is equal to then I should not be writing this.
Okay.
All right. Left child should be smaller than the root. tight should be smaller greater than the root. I actually wanted to go into the next discussion about the uh about the BST but um surprisingly it's the first path that um students are having doubts about the BST only. All right, left uh baby is lesser than the root. Right? Baby is greater than the root and I have every sub tree is a BST.
All right.
So these are the three rules that we have.
Can somebody tell me the the values of a fourlevel complete PST?
Can somebody try to give a fourlevel complete BST or just give it a give it a good shot?
Okay. What is complete BSC?
What does complete means?
Each root uh each node has their roots left and right both.
>> Yeah. Each root each node has left and right maybe.
All right.
So four level BST. Anybody? Vishad, do you want to give it a try?
>> Uh four level BST complete BS. Yeah.
So we have uh that means we have four levels right the uh I mean like uh I mean 2 to four uh nodes will be there in the last level >> two three >> so >> let's have eight nodes >> this will be here so first there a root and then there are uh two uh uh two uh uh nodes and then the >> give me the root value. They have >> give me the root value that you have to >> one and then you can have uh sorry I mean uh we can uh we can have negative values right >> you need to have negative values if you are starting with one >> yeah uh one then on this side we can have minus one or zero left left of three >> okay >> uh two Okay.
>> Uh - one. Sorry. No.
>> Uh - 5. You can say minus 5.
>> Uh left sub tree of the zero minus 5.
>> Okay.
>> Right.
>> Uh no no it can it cannot be it it has to be more than zero. Right. So I guess root we can say we can take 10 or 100.
>> Okay. Um anybody else wants to give it a try?
>> Uh we can start with eight. Root node 8.
>> Okay.
And then uh left uh would be four 2 left two and one 3 6 5 7 5 and 7.
>> Good.
>> Yeah. Then like 12 left is 10 and uh sorry uh 9 and 11 uh 14 13 and 15 but that's a good try four level complete BSC and if I have to check whether it is a BST 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Perfect it's It's a BSC that we have and it satisfies all the rules that we are talking about or given in the problem that is left baby should be lesser than the root, right baby should be greater than the root and each sub tree should be a BST. How do I determine whether it is a BST or not? Based upon three rules either I can use three rules. Is there any other way that I can check whether it is a BST or not?
I can check it with the three rules that we have. left is smaller than the the root right is greater than the root and every sub tree is a BST but other than this is there any other way that we can check whether a BST is a BST or not >> we can um print all the nodes and see if it's in sorted order >> we can print all the nodes okay >> we print a code to >> no no not like this uh starting from the left most node from one.
>> Okay. So in order >> Okay. If we do in order traversal >> in order >> if we do in order traversal in order traversal should be sorted or send it.
What is in order traversal?
Left sub tree, root and then right sub tree.
>> Left root and right is in order traversal.
Is there any other traversal in trees?
So in order reversal is not only in BSTs it's on trees. All right.
>> Pre-order post order >> pre-order.
>> Okay. What what happens in pre-order traversal?
>> Root comes first and left right. Loop left right.
All right.
Any other post order? Post order left, right, and root.
It's the position of the root that determines whether a traversal is uh in order traversal, pre-order traversal or post-order traversal. The BST's in order traversal is always going to be sorted or ascending in order.
This is also in order traversal only right root left.
This is also pre-ordered traversal that is root right left.
This is also postordered reversal only where we have right, left and root.
All right. The position of the root determines whether it is in order traversal, whether it is pre-order traversal, whether it is post order traversal.
But whenever we are given a in order pre-order, post order traversal by default we will be taking left comes before right. For example, left comes before right. left comes before right.
Left comes before right over here. Not the other way around that right is coming before left. Okay.
The in order traversal of a BST is sorted in nature. And that's what I did when I was looking at this. I was doing 1 2 1 2 3 4 5 6 7 then 8 left n root then right sub tree in the right left left 9 root 10 right 11 Left done root 12 then right sub tree in right left one 13 14 is the root and 15 is the right all right so in in order traversal left then root then right that is the order that we are going to do now we will go to the validating the BST for example one of the ways is that I can do the in tra reversal and I can check all these I can put all these elements in a list and I I can check whether it is ascending in nature or not but let's put the validating the BST on the back burner for now let's focus on recussion the nitty-g gritties the under the hood things of recussion each and everything about recussion we are we are going to learn we write a recursive function on this tree.
Let's call that function a helper private helper and we have three node root over here.
Generally the in order traversal is written like this that is helper root dot leftft.
Let's put system print.
It's actually system.out.print.
Let's call it app and system dot print root dot value and then helper off root.
And if root is equal to null, delta Let's call it one. Let's call it line two. Line three.
Line four.
Can somebody tell me what is this code written for?
This is a very famous algorithm in BST in order traversal.
>> In order traversal we are doing in traversal left then root processing of the root then the right. All right. So this is in order traversal but what we are going to do is we are going to do couple of more things. Print down.
print root and we have a stack recursive stack and we will be understanding the rules of recussion and we will not be leaving any blind spot.
Let's call it line five and we have to print the values over here.
So what will be printed first? All right. Firstly, when we start our recussion from here, what will be going inside the recursive stack?
What will be there inside the recursive stack?
Function >> function calls >> or function calls. Okay. Yeah, it will be function call. But what will be the root at that time?
Four.
All right. Anybody else?
Eight. Anybody else?
The first first uh frame will be will start right eight and then uh >> that calls four and then >> functional call on eight >> and that >> if there will be function >> just just a moment if there is a functional call on four where is the functional call of eight remains?
that will be in the that will be still in this uh >> not you I'm talking to the students who are saying that okay functional call of four will be the first recursive call that I will be adding it means what where is this functional call of a the initial function call of it >> isn't the very first uh at at the beginning at the beginning of the function Isn't the root value as eight?
So in line two when we put in root. Four goes in.
>> Okay. If four goes inside the stack, where is functional call of eight in the universe?
>> It's still in the memory in the stack like in the main uh after the main functions stack frame it will be function 8's stack frame and on top of that will be uh function four the stack frame of function four. So, so the function first functional call inside our call stack which is going to act as a recursive stack over here is functional call of eight.
All right. So when we come okay anybody who can tell me what will be the order of prints over here. What will be the output of this function >> in order 1 2 3 4 5 6 7 8 9 10.
>> Look at the print statements.
Oh, there we uh up one and up two, up three, up four. Up in order.
Mhm. Anybody else?
All right, let's try to do it uh one by one together. Uh give full focus. Okay, so function call of eight will be the first function call. We'll go to line number one. Is my root equal to null? We are at eight. 8 is the root.
All right. Then helper of root.
Recussion goes over here. Helper call off that is function call on left is called four.
All right. We have returned from here only we have gone to helper call.
The earlier one still remains that is there inside the stack.
Then we come to line number one again.
Is my root equal to null? Is this equal to null? No, it is not equal to null. In that scenario, we go to line number two.
That is roots left for left is two.
There is a functional call at two now which hits the function right here. Line number one. Is my root equal to null?
No, my root is not equal to null.
We go to line number two. Helper caller two's left that is one is what is happening.
All right. Helper of one. Root is equal to one. Is my root equal to null? No.
Root is not equal to null.
We go over here. Helper on root.
Functional caller. Null happened.
We go over here. Helper on null. Is my root equal to null? Yes, my root is equal to null.
All right. When root is equal to null from here return happens. Return happens where? From where it was caught.
Possible rule of recussion.
Return happens to the same place where it was not.
It's not about the place but whatever functional call has happened from if the functional call has happened from here it will return to the same functional call without exception without any second guesses.
All right. So I'm going to write over here just for your understanding that all these functional call have happened from line number two till now. Okay, they were left recursive calls.
So when return happens, it returns to the same place from where it was thought. It comes right here.
Now this functional call is complete.
Whenever a functional call is complete, what happens to the call stack?
>> It pops.
>> It pops. It pops. it has popped. That's why I'm putting a placeholder over here that it pops. When it is complete function called pops.
Now when we are at line number three, first thing that will be printed is all right, let me write the rules of the recussion for now. It returns to the same same place from where it was called.
P happens and one is to one mapping with parameter.
Now it's not a rule of recussion. This is just for understanding that the other functional call is out. Now at top of the stack I have the functional call as one.
What is the root of functional call of one? Where is the root now?
At one.
This is my current root.
So we call it one is to1 mapping just for understanding. But it is essentially what is the function call at the top of the stack and the root over there was one. Whatever has gone inside the stack will be the same thing that will be coming out of the stack.
So root is equal to 1. Now system.out.print up will be printed.
Up one will be printed.
Up one will be printed.
Once we have printed that in line number three, then what happens?
>> We go again. It goes to the right side of one.
>> Yeah. We go to line number four and it goes to the right side of one. That is helper call of functional column null happens.
And it was called from which line? Line number four.
Helper of null happens. We hit helper of null. Is my root equal to null? Yes, my root is equal to null. Return happens.
This is for the current function call that return has happened. Doesn't mean the whole recursive call will be complete.
Recussion will not stop till all these function calls are there inside the recursive stack.
Till that time recussion will not stop.
Now function call null is equal to null return happens returns returns to this to which place from where it was stored line number four it returns to this place what happens now >> down one is printed >> down one >> all right stackpop again because this function call is complete so stackpop happens what is the root Now again one function column one.
All right. Root is equal to what that is down one printed.
>> Now we are going down over here. There is nothing. The function has finished over here or you can think of it as a return statement.
Left of one is done, right of one is done. Left recursive call is done. Right recursive call is done.
Functional call on one is complete.
Means return happen.
Return with return to which place?
>> Route two?
>> Return to the previous call.
>> Tell me the line where where the where the >> line two.
>> Line two.
>> It was called from line two. It will return to line two.
All right. It returns to line two.
Stack. Has happened.
At the top of the stack I have function call two. So my root is two now.
We are right here.
What will be printed now?
Up two.
We print in line number three up two and then write recursive column two happen that is we go to three that is functional column three has happened from which line it has happened four >> line number this I am maintaining for your understanding. Okay. So when the function call is out you know that at which line I have to return the control.
This doesn't go inside the recursive stack. Only these go all right up to then function call on three happens from line number four.
Functional call on three happens. Line number four. Function control comes over here.
Is my root equal to null? No it is not equal to null. We come to line number two. Functional caller roots left that is functional caller null happens and it happened from line number two helper of null. We go over here is my root equal to null.
Yes, it is equal to n. Return happens.
Return returns to the same place from where it was found. Line number two. It comes right here. Pop has happened.
Because this function call is complete.
It will be going out of the call stack.
What will be printed now?
>> Up three.
>> Up three.
>> Up three.
We come to line number four.
Three is right. Call is done. That is three is right is null. Helper of null is done. Is my root equal to null?
Function caller null is done from line number four. Remember function caller null. We come over here.
What is equal equal to null? Return.
Return return happens to the same place from where it was.
Line number four. Tag. Happens. This is out.
What will be printed now?
Down three. Down three. Down three. Why?
Because this is a root now.
return happens. Now that is in English left recursive call of three is done.
Right recursive call of three is done.
Functional call of three is done.
When functional call of three is done, it means the return happens. Return happens to the which play?
>> Two.
>> Uh four.
>> Line number four.
>> Four.
It was called from line number four. It will return to line number four only.
All right. So it returns to line number four. Stack.pop has happened. This function call is complete. Stack.pop has happened. What will be printed now?
>> Down one.
>> Down two.
>> Down two.
>> Down two.
>> All right. Down two will be printed.
And we hit the return statement again.
That is function call on two is done.
That is left recursive call is of two is done. Right recursive call of two is done. Currently here is the control of the recussion. Left recursive call is done. Right cursive call is done. We hit the return statement.
Now where where is the control of recussion will go?
>> The previous tell me the previous. Tell me the line over here in the code please. uh line number two.
>> Line number two, it return it returns to the same place from where it was called.
It was called from line number two. The the control of the recussion will be going to line number two. Start out pop has happened. It means this function call is complete.
This function call is complete.
All right. What will be printed now?
Up what?
Up four. Four. Four.
The root is four. Here is the control of the recussion. Now then root.right function caller six is done. And that is now called from line number four.
Helper of six. Helper of six. Is my root equal to null? Is my six equal to null?
No, it is not equal to null. Helper of root dot left. That is functional column five is null.
From line number two.
All right. Function column five. Is my five equal to null? No, it is not equal to null. The control comes over here.
The code comes over here. Helper of root dot root dot left that is five left is null called from line number two that is helper of null. Is my root equal to null? Yes. Return returns to the same place from array was called.
Line number two. This function call is complete.
What will be printed now?
Up five will be printed. The code comes over here. Root. That is call on five right functional call on null part from line number four.
Helper of null. The code comes over here. Is my root equal to null? Yes.
return return happens to the same place from where it was called.
Line number four, it returns over here stack.pop. This function call is complete.
What will be printed now?
Down five. That is my current route.
All right.
And now we hit the return or the function has completed.
When we hit the return over here, we return to the same place from where the function caller five is complete. Five has called. Remember five happened. Left of five, right of five. Left of five is done. Right of five is done. Function call of five is complete. We return to the same place from where it was called.
It was called from line number two. We return right to line number two. This will be out.
Somebody's not not mute. Kindly mute yourself.
We return to the same place. Start. Has happened. What will be printed? Up six.
Up six gets printed.
Then root dot. Current root is six. Six.
Right.
That is it goes right here.
For the sake of time, I am deleting some of the nodes. Okay, let's take nine over here. But 11 I can delete. Okay, so I'm going to seven.
Function call on 7 called from line number four.
Function column 7. Is my seven equal to null? Nope. Helper of root. Happens.
Function call null happens. It has happened from which line? Line number two.
Helper of null. Root is equal to null.
Return return happens to the same place from where it was? Line number two.
Stack. Pop has happened. This is how.
Now at top of my stack function call of seven that is root is equal to 7. What will be printed? Up seven.
Now seventh right function call of null has happened from line number four.
Function call of helper of null. Is my root equal to null? Yes. return returns to the same place from where it was called stack.puff Top of top of the stack I have seven that is my root. Now seven will be printed.
Return happens. It means the function call of left is done right is done for seven. This function call is complete.
Return happens. Return happens to the same place from where it was called.
Line number four. This pops out.
Six will be printed.
All right. Down six gets printed.
Return.
Return return. It happens to the same place from where it was called. Line number four.
This is the current control function column six is done. Complete return happens. Return happens to the same place from where it was called. We have already noted down so that we don't get confused. It comes to the line number four down four gets printed and the control of the recussion is the four. Right here the left recursive call and the right recursive call of four is done the function call of four is complete in English.
If you want to see the code level control now four is printed.
This is complete. Return happens. Return happens to the same place from where it was called. Line number two.
Stack drop of apples.
What gets printed?
>> Okay.
And here is the control of the recussion. Right now up 8 minutes code comes over here. Root.
function columns 12 is done and that is called from line number four I'm going to delete this option then root dot left function call of tell is done from line number four sorry function call of 12 is 12 equal to null no code comes over here root dot left 12's left function Fun caller 10 has happened from line number two.
Function call of 10. Is my 10 equal to null? Nope. Left recursive call happens.
Function call of null happens. Has happened from line number two.
Function call of null. Is my root equal to null? Yes. Return happens. It happens. Takes us to the same place from where it was caught. It was called from line number two. will return to Nile number two. This is all start path happen. This function call is complete.
Control of the recussion is right here.
Up 10 gets printed.
Up 10 gets printed.
Then we come over here roots right function call of null has happened.
from line number four helper of null. Is my root equal to null? Yes, root is equal to null. The return happens. Return happens to the same place from where it was called.
Line number four.
This is out. Stack. Has happened because this function call is complete. Return has down 10 prints.
down 10 prints. Return happens. Return happens to the same place from where it was for. Line number two comes over here.
This is complete.
St. up.
Well, get printed.
up 12 gets printed root dot write function column 12's right that is 14 has happened from line number four helper of 14 is my root equal to null is my 14 equal to null no it is not equal to null we come right here helper of root dot left that is function call of null has happened from Line number two is my helper of null. Is my root equal to null? Yes, return happens.
We do hit the return statement. Return happens to the same place from where it was called. Line number two.
Track down pop has happened and up 14 gets printed.
We come over here.
Function call of null has happened.
From line number four helper of null is my root equal to null.
Yes, it returns to the same place from where it was called. L number four stack. Pop has happened down 14 gets printed.
The control of the recussion is right here.
Down 14 gets printed. Return happens.
Return happens to the same place from where it was. Line number four.
Track pop has happened.
Down 12 get three.
Return happens. The return happens to the same place from where it was called.
Line number four. This has popped out.
And now down close recussion is right here.
Down 8 root is right here.
Down 8 gets printed.
Return happens.
Return happens to the same place from where it was called. It was called from line number two. The call stack is empty. All the function call is complete.
This is the print statements that we will print.
Recussion returns to the same place from where it was called. One is to one mapping of the parameter happens. And recussion doesn't stop till the time the call stack is not empty.
And this was the flow of the recussion till now. Anybody any questions till now?
All right. If you were observing it carefully, can you tell me what was the maximum number of calls inside the call stack or the recussion stack right here?
What were the maximum number of calls inside the recussion call stack over here?
>> Five at any point.
>> Five.
>> Five.
>> All right. Five. So can you tell me in terms of this trees parameters or trees input variables what is five over here for example for this >> yeah height of the tree of h so number of maximum calls inside the recursive stack at any point was h that is we had five one was fun that's why height of the tree is the maximum space inside the recussion stack that we took.
All right. Before moving forward, let's validate whether our understanding of flow of recussion is complete is completely correct or not.
Uh in this case, isn't the height of tree?
cuz uh we are going left >> 1 2 3 >> 4 2 3. So >> 1 2 3 4 depends what how we are defining the height.
You want to define height as height minus one you can um do that also. So if the interviewer says that okay the depth of the tree over here just if you separate question if they say tell me what is the height of this tree >> three or um somebody can say four it's a fourle bs >> all right it's the way that you you are defining your Thanks.
Let's order a list.
Now I'm not going to use this array list. I'm going to return a wrong answer over here for the in order reversal.
Don't worry about that.
But let's make the tree over here. And if you see how I am defining the tree over here or how I'm I'm writing the tree over here then this is the way that you can do on lead code or this is the way that you know going forward you'll be learning about uh a concept of serialization and deserialization but for now just observe how we are defining the tree eight on the left of eight we have four on the right of eight we have 12.
Now the next node is four. On the left of four we have two.
On the right of four we have six.
On the left of 12 we have 10.
On the right of 12 we have 14.
On the left of two. Now we have one. On the right of two we have three.
And it will keep showing you the tree that you have built till now. On the right of six, on the left of six, we have five. On the right of six, we have seven.
And that's it.
All right. This is the tree that we have. Let's write helper root.
or function call.
Just replace our helper on the whiteboard with this in order traversal and system.out.t print up system.out out. Print row dot value and in order traversal or root dot write and below that print down statements and for your sake of understanding stat.puff pop over here the way that we have written on the whiteboard and start right so you should not be giving us the because here they want the in order reversal we are just using this problem for printing statements all right for understanding the flow of recussion okay I forgot to do Let me do one thing.
Private void helper call on preload node root so that it matches with the whiteboard option and I'll take these If the root is equal equal to null helper helper and we'll do the initial helper call root just to print the flow of recussion.
All right, it gives us a result is empty. But let's look at the print statements. Print lite.
Let's try it.
All right. Let's try it with the whiteboard to see if the if our understanding of flow of recussion regressive stack is correct. Up one, down one. Good. Up two. Good. Up three.
Same thing. Down three.
Perfect. Down two. Perfect.
Up four. Perfect. Up five. Perfect.
Down five. Perfect. Up six. Perfect. Up seven. Perfect.
Down seven. Perfect.
Down six.
Perfect.
Down four.
Perfect. Up. Eight. Perfect.
Up 10, perfect. Down 10, perfect.
Up 12.
That is there on the whiteboard also. Up 14. Correct. Down 14. Correct.
Down 12. Correct. Down 8. Correct.
That is the flow of the recussion that we have. All right.
Without understanding the flow of recussion, we will not be able to do normal recussion.
We will not be able to do the backtracking. We will not be able to do TFS. All right. So, understanding flow of the recussion. This is one of the most important lectures in the whole cohort. Understanding the flow of the recussion. Lot of students think that okay, at the code level, we'll be able to understand the recussion. They uh they are in for surprises later on. All right. Always if I remove this then this becomes an inorder traversal left processing of root right and if I print surprise surprise everything will be in a sorted manner 1 2 3 4 5 6 7 8 9 9 is not there 10 12 14 and remember why because our tree was the tree that we had built over here or on the whiteboard is a BST.
So this is nothing but if I remove this this is nothing but the in order reversal.
Quick question if I remove this and I print this what will be what will be your comments post.
>> It is a post order reversal. So if I print this this is nothing but the post order reversal that we have. All right.
In which left right root left right three roo<unk>2.
This is nothing but the post order traversal.
Make sense? So kindly understand the flow of the regression. It is very very important. Anybody any questions till now?
Add value this result just completing the in order to problem over here. Okay, this result is error. If I run this, this should be working fine. This if I submit it, this should be working fine.
This Huh?
This is the in order traversal. In order traversal is the one that we used for understanding the flow of the regression.
But let's come back to the parent problem of validating the BST. Right?
One of the ways that I can validate the BST is that I just take this from here. Whatever we did over here, we put in inside the result.
I create a resultant list over here. Just the way that I created over here pirate.
Video helper of tree node root system.out print the result over here.
All right. So if I do this in the helper call I can take it from here.
Remember this is the in order traversal. Now that we have basically in order traversal and we print the result it will be in a ascending order right for any of the trees for this tree that is 5 1 4 3 6 1 left root then 1 5 3 4 6 which is not in a sorted manner so it's not a BST but if we take this tree over Here this is a BST. It will be printed in a sorted manner.
It'll be sort printed in a sorted manner and that's what should have happened.
But we are using an extra result list over here and that result will be containing all the element out of BST.
We are using extra space even though that extra space is not required. So how do we do it without using a resultant list? How do we do it without storing all the elements inside the result and still do the inord reversal only to validate whether it is a BST or not?
Anybody any suggestions?
>> We we check uh if uh the root value uh is greater than the left uh and the right and then we recursively call is valid BST.
>> So um means in order traversal will not work.
So you're suggesting a new algorithm over here, right?
>> No. Uh so you can do that in in order like we check uh if left is smaller than the uh root.
>> Okay.
>> And is uh BST on the left.
>> What is in order reversal? In that we print the left and then the root then the right. So we we go on uh to the leftmost node.
>> Okay. Let let me modify my question. Uh can I do the in order traversal without using the list without storing the elements inside the list?
>> Can we uh do in order traversal without storing in the list?
>> Yeah, >> we want to print everything, right?
Do I need to print?
>> So, uh, just you want is valid BST, right? Uh, or >> do I need to print or do I need to store all these elements in a list?
>> Is there any way?
>> Huh?
When I'm saying that can we do something, it means we can Yeah, man. What were you saying? Go ahead. Go ahead. I might >> Yeah.
>> So, uh uh for uh is valid BST uh can we do this without storing it in a list?
Right.
>> Yeah. Can we do it without storing it in list? Without storing without storing the in order traversal in a list?
>> Yes. uh like what I'm suggesting is uh like we compare the root >> with the left value and the right value of the root.
>> We process the root.
>> Okay. Then >> and then we call on the uh left should be also a valid BST and right should also right should also be a valid BST.
>> Root. We call a function call on root.
And then we call a function call on root.right. Correct.
>> Yes. Yeah. Is this in order traversal then?
>> Uh no uh it's pre pre-order traversal.
>> So we can do it with pre-order traversal. What you want to say over here is uh that with in order what I'm asking over here with in in order it is not possible because we were on a discussion of in order reverse right we can store the elements in a resultant list. So should we come to a conclusion that if we are doing in order traversal we will have to store the elements inside the list only neither we'll have to abandon in order traversal and we'll have to go to pre-order traversal is will that be a correct statement if I make make that >> yeah so far I'm not able to find a use case where we can do it within order so >> okay anybody Anybody else?
>> Okay. If I have the in order over here, if I have the in order to vessel and I'm storing it in a list, then it is 1 2 3 5 4 5 6 7 8 10 12 14. Correct? If I do an end order traversal, I store the elements in a list like this. How do I check whether this list is ascending in nature or not?
Whether this list is sorted how do I check that?
>> I just iterate through it.
>> Just iterate through it and iterate through it. What? Like I'll go over here. Now what? Then I'll go check >> at two. What should I do?
>> No.
>> Check its next element. If uh if it if it is greater than just one if it is not then >> lift if it's next element three should be greater than one >> greater than two like greater than one unit >> yeah I missed the part that we we I missed the part that we might have missing numbers I missed that part >> forget about that I am giving you a list a simple list this The list universal tell me whether it is sorted or not. How would you check it?
>> The first and the last most element. The first >> the first first and the last last most element. If first one is smaller, last one is greater than the whole list is sorted.
>> We have to check the next element is less than the previous element then it's not sorted.
>> Yeah. Let's have current element and the previous element. If two is greater than one then we move forward.
If the current element is greater than the previous one just that thing it's there is no rocket science over here. You want to check whether the whole list is sorted or not in a brute force manner. If you want to check whether the whole list is sorted or not, just take three is greater than 2, 4 is greater than 3, 5 is greater than 4, 6 is greater than 5, 7 is greater than 6, 8 is greater than 7.
This is the way that we can check now or I can say I can have two pointers and this middle pointer over here, if this is current pointer and this one is previous pointer, current is greater than previous. Then move both the pointers.
Check four is greater than three. Move both the pointers.
Five is greater than four. Move both the pointers.
Six is greater than five. This is a way that we can check whether the complete list is sorted or not.
One current pointer, one previous pointer. Now why do I need to store all these elements inside the list? I can just move the pointers on the list on the BST on the tree itself. Huh? I have the root which is the my current and one previous pointer to it. That is what what is the previous element.
Why do I need to store all the elements over here?
I just run two pointers on the whole tree only. The tree is giving me this list now.
So if I am able to mim that before one there is nothing. When we are at two just compare it with the previous element.
I'm saying previous I'm not saying left.
Don't start making assumptions. I'm just trying to mine. But I will do it on list. If I had stored all the elements in the list, how would I check whether the list is sorted or not?
Just keep checking two elements.
2 is greater than three. 2 is greater than one. 3 is greater than two. Four is greater than three. So for I don't need to store all these elements inside the list. I can these these elements are coming from BST only.
I can do the previous and the current on the PSC itself.
So initially remember this will be printed. This was a print of the in order traversal.
At that time I can have a previous at the null and current at initial root which will be printed or which will be processed was one at that time. I don't need to check one with the previous because there is no previous to the one.
I don't need to check whether it is greater than there is no previous yet.
But once one is done, I'll move the previous pointer to the current position and current goes to the next position.
What was the next position in the in reversal? What was the next route which was printed? It was two current when two comes out of the stack or two is get about to be printed at that time and just check it with the previous If everything is fine that is two is greater than one then I'll move the previous to the current position and what was the next note which was which was printed in in order traversal was three my root will be here my current will be coming right here I check the current with the previous is three greater than two it is greater than I'll move the previous to the current position and current will be then at four.
Just check four is greater than three.
Yes, it is greater than three.
Then move the previous to the current position.
Next position of current is what? Five.
Just check current with the previous. Is five greater than four? When it is fine.
Move the previous to the current location.
Current to next location.
If at any point during the tree there is a breach, we'll say that we have found a breach.
It's not a valid BSD.
we can store it in a flag.
All right. So let's try to do it without storing inside the list.
We can this list was coming from the tree only now. And how do we check this is current? This is previous.
Current sorry previous current. Exactly.
This is the movement that I am miming on the tree. Move the previous to the current location. Current to next location. Move the previous to current location. Current to next location. Keep checking whether they are breaching or not. Move the previous to current location. Current to next location. Move the previous to current location.
Current to next location. All right.
This is what we will be mining.
If I try to run this, if I try to write code over here, I just need a previous pointer to validate a BST. I don't need to store it in a result.
So let's have a private tree node previous.
All right. add a boolean flag and I'll do a helper call or you can call it in order to call in order.
What kind of call I should be doing?
Will it be a boolean based recussion?
Will it be a void based recussion?
>> Boolean. boolean based recussion.
Let's do that. Private void in order reversal on tree node rule.
All right. Base case logic in the logic in the in order traversal what do we do? Left in order of root do.
in order of fruit.
And we have to process the root in between. Now process root here.
How do we process the root?
If my root dot value which is current also root dot value is greater >> lesser than lesser than or equal to previous dot value in English it means what the root is smaller than the left child.
So I just said that okay current previous current previous there is no left there's no right is this is seven over here and six over here is six the left child of seven.
This is in order reversal. You are still stuck onto one of an algorithms which is which we are not even doing which we are even not attempting. We are just reversing over this list and we are checking whether the current is greater than the previous or not. If current is not greater than the previous. If rather than seven if we have two over here then what?
>> Return false.
>> Return false. This is not a valid BST.
That is what we are trying over here.
If my root dot value is lesser than or equal to previous dot value, root is current. If current value is lesser than or equal to previous dot value.
All right. At that scenario, we have a breach of BST.
All right.
And we'll make the flag equal to pause.
I cannot compare the initial one. If previous is equal equal to null means we are right here current was equal to one previous was null then previous came over here current went over here. All right. So one should not be compared to anything because there is no previous value to it.
And remember by default the previous is getting initiated over here in the global with null.
>> Previous is not equal to previous is not equal to it. flag zero to false and the base case if my root is equal to equal to if at any place we have a breach the flag will become false I'll make the initial flag as true if at any place it is has breached the valid it's not a valid BST we'll be catching it with flag is equal to false and root return true not true return the flag if I try to run this code now let's see what I'm saying that I'm doing need to change the previous value >> yeah we need to change the previous value my bad previous to current position move the previous to the current position before doing the right recursive call once we have compared remember this is what we have to mine current previous once we have done the comparison move the previous to the current position this is what is pointing out and he's absolutely correct then move the current to the next position a current in this scenario I don't need a current separate current uh pointer because root is my current root is my current node that we are working with all right if I run this this this should be working fine oh current routter working fine. If I submit it, this should be perfectly accepted.
>> Here like we are making the flag as false, right? So the recussion will still keep on going. I mean it won't stop at the fall. We >> we'll we'll come to that. That's a good question. Good great question. All right. Anybody any questions till now?
I want to bring the first this as the first test case.
Okay.
And the second test case is 1 2 3.
All right. What Bulkit is asking is a great question. If I do system dot out dot print root dot value over here apparently we are processing each and every node. So in the pre-order manner all the roots will be printed and they will be printed in pre-order manner. Right?
If I'm printing it right here they will be printed in the in order manner. This is pre before the left now. So all the nodes will be printed 8 4 2 1 3 6 5 7 whatever is there on the whiteboard everything is printed all right or let me print it over here in order so that it is in sorted manner okay 1 2 3 4 5 6 7 8 All right so I'm printing it over so that there is no confusion. Okay. So all the nodes will be printed.
Imagine imagine if we have a breach over here rather than one if we have seven over here. Uh like 100 over here rather than one if we have 100 over here or 10 over here.
And rather than 10 we have in. Okay.
Is this a BST now?
Anybody?
It's not a BST. So we should be getting a breach and correctly we are getting a breach.
Where is the breach happening over here?
10 is uh like >> greater than >> 10 is greater than two or two is smaller than 10 now. So it will be getting caught over here when the root value will be equal to two and the previous value is equal to 10. At that time we'll catch it that there is a breach.
So the breach has happened over here.
But if I print the elements over here what pulkit is saying all the nodes will still be printed.
Recussion will go to all the nodes and not surprisingly why because whatever has gone inside the recursive stack has to be completed. Function call on 8. First function call was function colon 8. In the recursive stack we had at the bottom function colon 8 then function column four then function column two then function column 10. So and so forth.
The breach has happened at this place still. Why are we recursing on 10 and 14ths and 12ths? 11 now. Okay. Why are we going to 11th and the 14th and 12th?
And why are we checking the fives and the seventh?
If the breach has happened here only, why do I need to go to the sixth and the fives and the seventh and the 11th and the 12th and the 14th?
Can we do something that we can save some of the recursive call? Save some of the recursive.
How do I modify?
>> Check the flag in the first condition.
>> Check the flag in the first condition that is line 26 right here. If the flag is equal equal to false, then what?
return for uh like do nothing just return >> just return all it now this what we have done till now is the dump brute force recussion it's non conditional recussion over here as soon as I bring that check if the flag is false already or not then that is conditional recussion if the flag is false now you don't need to further recuss is what Imran is saying in English.
I don't need to do the further recursive calls if my flag is equal to false or I can do it like this.
Flag is equal to true then only do the right recursive call.
Then only do the right recursive call.
Or I can write write it like this. If the flag is true then only conditional recussion. Now if the flag is true then only do the left recursive call. If the flag is then only do the right recursive call. If I do and run it now then I will be able to save surely able to save some of the nodes. All right. Now which are printed is 8 4 2 and 10 only. That's it. 8 4 2 and 10.
Earlier one was non conditional recussion. This is conditional recussion that if the flag is true then only go towards left. If the flag is true then only go towards right. If the flag is already false why should I go towards the right?
I don't need logically.
And this is the same as what Immran was suggesting that if my I can put this condition in the base case of or flag is equal to if the flag is equal to false already return don't go further don't do the further recursive calls no need to do the check for the checks if breach has happened I don't need to go to the further nodes if I do that I'll be printing same.
Now I have moved that condition inside the base case.
This is called conditional recussion.
We will be doing it at many places where we will be doing non-conditional recussion then we'll be doing the conditional recussion.
Is there any other way than checking the flag?
Can I do this?
The inter says oh it's working perfectly working code what if I put put the return statement over here how many nodes will be printed over here remember in the earlier case 8 4 2 and 10 were printed now the breach is still happening at 10 only and I put the return statement over here if flag is going to pause false If I put the return statement over here, what will happen?
Just take a while guys.
Although you should not be taking guess because it is bas based upon the recussion rules that we had learned.
>> After 10 nothing gets printed like till 10.
>> Till then 10 only 8 for 210.
And why why do you think so?
>> Not going to the right tree. After 10 >> not be going to the right tree. Anybody else?
How many nodes will be printed over here?
>> Only three.
>> Only three. Three nodes. 842.
>> 842. Yeah. Okay. Anybody else?
>> So, um we we will go uh we will start.
>> No, don't worry. Just tell me how many nodes will be printed.
>> I think all of them would be printed.
>> All of them will print. That's a very revolutionary.
All of them will be printed. And the reason >> uh because in in the function call we we still have all the like drivers basically the function.
>> Good good. Let's run it.
All right. It should have given us a correct answer. It has given us a correct answer. But the good thing is that we should be looking at how many nodes are printed up.
10 only. Four only.
If I print the return statement over H but is may I incorrect over here.
Let's try to make this as one now and this as 13.
The breach has happened over here.
Correct.
At this place the breach has happened.
If I try to print how many nodes will be printed over here.
Okay. Let me think about a test case.
Not is too much. Okay. That's the difference.
Is this a BST?
If I run this, should it be giving you BST?
Should be giving us a false. It's not a BST, right? And where is the breach happening over here?
And this D F2. All right. Or let me make this as three only. And make this as rather than one.
Let's make it three.
Where is the breach which has Oh no.
Yeah. The breach has happened right here. No. At this two and three.
Right here.
So if I take that it was the other one was really big that it was you know printing four of the nodes only. But if this happens the breach has happened right here two and three but still it is printing what the 12th and the 11th and the 14th also.
This side of the tree also even this side of the tree it is printed.
If I make it five just for sake of simplicity if I make it rather than three if I make it five the line 31 less than or equal to pre it has to be less than right. Just a moment. If I rather than five, let's have four on it.
All right. But what will be printed over here? All the nodes still.
Still the 12th and 11th and 14th are getting printed.
Why is the 12th and 11th and 14th are getting printed even though I have the return statement over it?
So what I'm trying to say over here is in some of the cases if I have the breach right here only at this place why are we going to the six and the fives and the sevens and the 11s and 12s and 14s with this return statement in the function >> in the function call when we were calling four >> uh there was left of four was two but that's not where the breach happened. So we went to in order for left right and so this this is still in the function call like all right let's see it on the whiteboard let's not have 10 over here let's have three only over here recussion call stack it started from here on it functional column 8 functional column four functional column two functional column three functional column null right so firstly null is out the first node is three which comes out or the recussion stack in the in order manner we compare it with the previous previous is equal to null move the previous to the this location then we do the function call on the right that is out none null Both are out. Function column 3 is out. Now at top of the stack at the in order level we will be printing two. Right? So two is the load that will be compared with this is the root that will be compared with the previous.
We have the breach. We make the flag equal to false.
And after that we have return.
It's a myth that the return will be completing completely stopping the recussion.
PE students who think that only 8 42 3 will be printed they are thinking that this return will complete the functional calls. it will stop the recussion.
It doesn't. It is against the two basic rules of recussion that we we did.
One, whatever has gone inside the stack will come out of the stack. Surely the call stack does have functional calls still left. That is what Mang was pointing out towards that I still have the functional calls left inside the recursive stack.
The second thing that we made assumption is that return will be not taking the further will not be taking us further.
Recussion will stop over here is again a breach in the rules. The first rule of recussion was returns to the same place from where it was called. That's it.
Doesn't mean that it completes all the functional calls. It just completes that functional call only.
It was the it will be returning it will be returning to the function call of two. That's it.
Functional call of two is out then the functional call of four will start.
So the purpose of this return statement is returning to the same place from it was called. That's it. It was not stopping the further recursive calls.
the further recursive calls will still happen.
If you are assuming because of this return the whole recursive function will be complete then you should have said the same thing for this return also that we hit the return and we are done. No, just like the way that this return behaved that it returns to the same place from where it was called. This return will also be doing the same thing. It will be returning to the same place from where we called it.
It will go back to the function call of two that will be popped out and still four will be further running ahead.
The further once four is complete four will be out. Function call 8 will be done and then we are doing the right recursive call without any condition.
Without any condition we are doing the right recursive calls. It will do the right reccast really because at the further ones there is no breach.
Thinking that this return statement will be able to do the condition recussion is a wrong basic that you might have assumed.
It's the if you have to do the condition recussion then you have to do lag equal to false you'll have to do the condition recussion like that now I'll be having 84 23 that's Oh no.
I want to do the last basic of recussion today and then we'll be stopping.
Firstly uh uh it's a myth that if I have a boolean over here I have to do the white function also as I have to do the recursive call as boolean also. All right. I can do boolean based recussion.
I can do void based recussion also. In all the problems that you have done uh int based recussion or boolean based recussion where you have integer you thought that wide will not work. Wide will surely work. In all the problems where you have seen wide based recussion there the boolean or the inbased recussion will also work for it. So if I don't want to do this way I can do a boolean based regression over here.
return true.
Thus converting into a boolean based recussion. A boolean towards left.
Left recursive call and right call is a boolean right.
Then return left and right.
All right.
If I want to convert it into a boolean based recussion, I didn't do anything. I just put the from the left recursive call we are getting a boolean. From the right recursive call, we are getting a boolean. Rest of the things were kept absolutely same. If the root is equal to null, return true. If the breach has happened, return forge that the breach has happened. It's not a valid BST. I don't need a flag now.
Works. If I submit it, this should be working perfectly fine. All right. If I do system.out.print root dot value, how many elements will be printed over here? All the nodes.
Remember there is a breach right here.
Still all the nodes will be printed.
So this is equivalent to nonitional void based recussion.
Non-conditional voidbased recussion.
If I want to convert into conditional then I can say that if my left is equal to false then don't do the right return false if I submit it this should be accepted but what what's cute will be to see how many nodes will be printed over it all right if I do this how many nodes get printed four so this is conditional recussion conditional boolean based recussion similar to conditional void based recussions.
All right. Now I can clean this code a little bit. I say that if my left is equal equal to false that is if this is equal equal to false return false right here.
Don't go further. Don't do the right write right recursive calls.
Same thing.
All right.
Still four only committed. This should be accepted as well.
All right. Since this is then I can return.
A lot of times you have seen this code for valid APS but it is nothing but where we started with the white basic questions. Slowly slowly just updating the code right still four nodes will be printed over this is conditional recussion only why if the left is equal to false return false don't do the right recussive part so we can do wide based recussion we can do boolean based recussion we can do wide based non-conditional recussion we can do widebased condition recussion or but now let's see we are going to cover one of the basics of the recussion again let's go to the white base recussion again Let's go to the white base.
Okay, done.
Hey, quick question. Okay.
Why do I need to have the if I put the three node previous over here?
Is there any issue or the concept that we are trying to learn over here is that what all parameters I should be having in the recursive calls.
Why do I need to put it in the global?
Can I put it in the scope of recussion as a parameter of recussion? Can I put the previous as a parameter of recussion?
If I run this, I it doesn't work. Maybe I'm making some mistakes. Tell me what are the mistakes that I'm making.
>> You need to pass a value pre like initial value for null.
All right. and previous over here.
Probably the previous over here still doesn't work.
Am I making some mistake?
>> Anybody?
>> Yes. What is >> flag passed by value and not by reference?
>> Pass by value passed by reference. Good.
Okay. Yes.
>> Isn't previous root >> previous is equal to root. Okay.
>> No. In the line 28 uh >> previous is equal to root.
Okay.
M okay. Yeah, >> you won't need line 34 anyway.
Okay, still doesn't work.
Okay, if you are saying this then you are missing one of the things. Was I doing this that when I went to four? I'm making the previous of four is equal to 8.
Or when I'm going to two, the previous of two is should be four.
>> No, we are not doing that.
>> We are not doing that.
So if I say that okay, the previous is previous itself. Still doesn't work.
You can do this.
You do anything it will not work.
What is the basic mistake that we are making?
We make it root. Okay.
>> Yes. Tanya, go ahead. What were you saying?
>> We're passing flag by value.
>> We're passing flag by value. flag isn't is not passed over here. I didn't change anything about flag. I changed previous.
>> You're passing previous by value >> by pre previous by value. And what what does it lead to?
>> We don't retain the value of previous.
>> Correct. That's a great all right by value and by reference concept and it is very imperative.
All right. You might be giving a working test working code in your recussion. You can be giving when any of the recussion if the interviewer catches you at the by reference and by value concept. Now the game is done over here.
All right. You might be even optimizing that with with repeated sub problems and you have implemented DP till the time you will not be able to get the by value and by reference concept you will be out and if you are an interviewer in the normal recussion in the in order traversal or validate BST only just please do check that by by value and by reference concept it is in too many production systems in lot of libraries for example react everywhere by value by reference concept.
What is actually happening over here is 1 2 3. If I have the remember one is to one mapping a helper of three node root and three node previous.
We have this code. Now let me take this example right here. 1 2 3. And what are we doing? If my root is equal equal to n return and then helper of root dot left you take the previous as previous over here you take the previous as root over here doesn't matter the problem is not what you are taking over here the problem is by reference by by valance helper of root.right and previous. Here what you are doing is previous is equal to root.
Here you are checking if my previous dot value is greater than or equal to root dot value is equal to false in the code. Let's run it along with the coder.
test case is 1 2 3. See if I submit it, it gives me the test case 1 2 3 is correct.
Means I should be expecting a false.
But it is telling me that it is true that this is a valid BST.
this code right here that we have written let's call it root this code that we have written over here is telling this is a valid BST it's not a valid BST what is happening over here remember draw the recursive star functional column one and the previous is none.
All right.
This is the very first call. Is my root equal to null? Is my root equal one equal to null? No, it is not equal to null. Then we go over here.
All right. Function corner. We come over here. roots left that is ones left two and we made the previous as one it's fine we should not be making we should not be comparing two with one we should be comparing one with two two should be compared with so let's change it to previous Let's keep it null only.
Is my root equal to null? No. We come over here. Roots left function call on null.
And what is my previous null?
Is my root equal to null? Yes. Returns to the same place from where we called it. This is how.
So two gets compared to null and we don't compare it. Why? Because we were checking it right here that previous should not be equal to null.
Doesn't matter. You made the previous is equal to root. You the previous right here and then you did the right recursive call function call nulls. Null out.
Both left and right recursive calls of two are done. Your preface is still at two.
Then you took this.
This is out. Return happens. Return. We return to the same place from where it was. Right here.
When the stack pop has happened.
What is your root now?
One.
What is your previous now? One is to one mapping root is one previous is what?
Now your whole jing bang of making the previous is equal to two over here it the previous was made equal to two.
There is nothing wrong.
The problem is whatever goes inside the stacks with will exactly unfold the same way.
Now when it unfolds over here stack pop has happened one is one mapping has to happen root is equal to one but it's previous null over here the previous is null one is never compared to to one is compared to null and that is not compared why because in the if statement I have if previous is equal to none don't compare so I don't catch the breach over here I should have caught A breach over here at 1 2 now one is getting a pair to null.
You do anything make it previous make it root make it null. So what one has gone inside the recursive stack. Whatever you you came with nothing you go with nothing. Similarly inside the recursive stack whatever you came with you will be unfolding the recursive stack as it is.
Now one is getting compared to null.
doesn't get compared and you don't get the breach only then you go to three three is already greater than one done you never catch the breach so if I print over here in the this test case over here in the second test case if I see over here system dot out dot print root value and system.out.tprint print len ln the previous you'll see that one is getting compared with null over here.
If one is getting compared with null over here then the whole game is over.
You can make it root, you make it previous. Two will get compared with null, one will also get compared with null. Because whatever has gone inside the stack will come out of the stack as it is. One will get compared with this was not happening in the earlier scenario. If I put the reload previous in the global, it doesn't doesn't go as a parameter of recussion.
Then let's see this.
Now let's see that one is getting compared to what? One is getting compared to three node this which is actually equal to two.
If previous is not equal to null then write the value of previous. If it is equal to null then print two will be compared with none. One will be compared with two. If I have the previous in the global because in the parameter the previous is going by value and when the recussion stack unfolds it unfolds the same make sense. Hence the bridge. So this is the parameter of recussion versus global variable.
Good. We are done with the class.
Anybody has question can say we'll carry on with the lecture from here only we'll be doing more recussion we'll be going into the nitty-g gritties of recussion and we'll be doing a lot of what test scenarios all anybody any questions can you uh just summarize in like a single sentence maybe the last issue was we were passing uh like value and we are not able to retain um >> it is 420 then it is 8 it is 840 It is 1220 node 420 840 1220. It is going by value. So it unfolds by value that is null has gone. It will be null only then it will be whatever the next node 840. All right. Whatever that node is or it is 1220 whatever that node is. If you are putting one as null, functional call of two as null, functional call of three as another node that is eight, it is this three node, this null, this null. All right.
But if you put it by reference if you put it a pointer on it that is you put it in global tree node a pointer on it previous all right I'm using the syntax of C++ over here just to show you then it doesn't need this we don't need to do this >> this is bas this is basically globalizing the variable then I'm having a single reference all right if I have a single reference that is actually equal to single reference then 1 2 3 it will be made as this will be made as that reference 420 will be made as two then one will be compared to all we'll further see it uh just leave this concept for now for tomorrow also right we'll even >> if you're passing parameters value we do something in the code, right? To make that work. I mean, >> what what can you what can you do?
>> No, I mean like just >> Yeah, probably it's a very dangerous work.
Probably is a very dangerous work.
All right, you can do in some of the scenarios but not in all the scenarios.
All right, Pulkit, what you are trying to say is I don't I want to go wrong on the basics but I want to still find a way out, find a hack out. All right. My question is why do you want to go wrong on the basic?
You can.
>> Okay.
>> In some of the scenarios, all right, but don't get into that habit because somewhere you'll be burnt. Make sense?
Yeah. We're done with with the class.
Bye, guys. Have fun.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
🚀 BCS613C Compiler Design | Module 1 to 5 Schema Evaluation 🔥 | VTU 6th Sem 💯 #VTU #bcs613c #exam
Pranavaa-y4y
104 views•2026-06-02











