Hello and welcome to this video.
In this video, let us go first, I can choose.
So let us start with this dark, so stark, so stark follows LIFO approach, which means last in and first out approach.
And the insertion and deletion in the stack happens at the same end.
For example, we can represent a stack using a range of book kept on each other.
We can access only the topmost book and we can keep the book on on the very top, which means insertion is happening at the very top.
And deletion is also happening at the very top.
But this is how we can understand the stack.
Now we have two operations for this time.
The one operation is to add an element into this type, which is the push operation.
So I will write that or here.
So in the Bush operation, we will pass and eliminate.
Which we want to add into the stack.
So this element can be anything depending on the problem.
It can be either an integer string or list or anything else.
Then to remove an element from the stack, we have operation when we call the pope, it will be the topmost element from this stack.
For example, if I did this element, for example, if I call the Bush operation.
And if I want to add, lets say, 100 to the stack, so I will call Bush Hundred.
And this hundred.
So theres an element.
Added to the stack at the top.
When we call of Bundestag, the topmost element or whatever it is, will be removed.
So hundred will be removed if I again call the method, the again the element which is on the top will be removed.
And this will follow until the stack is empty, the steak is empty and we call the perimeter.
We will cordon.
That I suppose if I push one zero one and this is my element, one zero one.
And if I call Push Matter on the stack, then this will add one zero one to the stack.
Then if I can push a hundred.
Then this element will be again added to the stack.
So this is a wash and pop operation on a stick with us.
Now let us move toward the You Now Kill follows first in, first out approach, which means insertion and deletion happens at the opposite end.
Mr Porter, the element of which is which we have entered at the first, will be removed first, for example.
For example, if we imagine the people waiting for a motorcade outside a movie hall, then the first, then the first person will take the ticket and out of the queue.
And then second person and will go for their ticket on the ticket counter and get his ticket and world of the queue.
And similarly, a new person come here will be joining them at the last.
So this is all good works now there.
Now we also have two options for the queue.
The first operation is called as new.
Now in and cooperation, I can pass that element.
Which I want to add after calling and committer, that element will be added at the last you.
And then we have a documentary.
When did your method is called or they were the element which is at the front of the queue, which will be removed from the front of the queue? For example, if I want to NQ, lets say for someone to our queue, then I will call the NQ and I will pass the person one.
Thanks to our goal function.
I will pass the virus on to our new function.
Then this encore function will add the person on at the last of our queue.
And if I call the digger function, the person who is in love is on the front.
There is a person.
Thirteen will be removed from the queue.
Then this other persons will be adjusted.
And if I can call the ridicule.
Then the person on the top will be removed.
If I again called the entire function with passing by some 13, then this person, then the person 13 will be added are the last of the queue.
So this is all in queue and the queue operation on the queue works.
So let us summarize this.
So we have a stake and cures.
So Stack follows last in, first out approach and we have queues, which which follows first question first order approach.
No insertion and deletion at the stake happens at the same end, and insertion and deletion in queue happens at the opposite end.
At this time, we have Bush and Operation Bush operation will push and eliminate at the top of the stack and call it operation will remove the element from the top of the stack.
Now in your function in Q will add the element at the last Q and the Q function will remove.
And eliminate from the front of the queue.
Now, I hope you are understood the stack and Qs.
So thanks for watching this video, and I will see you in the next one.