00:01
The question is asking to give an example about a q and a stack, right? so we'll start with the q.
00:06
So q, the best way to describe the q in computer science is basically a collection, right? so it's a data structure, so it's similar to a list or an array.
00:21
Except a q can be an implementation of a list or an array.
00:26
And the q is really just a specific way to implement a data structure.
00:30
Is a collection of entities that's maintained in a sequence.
00:34
So the order matters in a queue.
00:37
And you can add to a queue and you can remove from the queue.
00:40
And that's where you get really, that's where you can really separate the difference with a queue and a stack.
00:52
So to first to start out, a queue is obviously, i already said, it's an order data structure, right? so operations can be performed.
01:01
The order for q is we abbreviate as fifo, which is basically first in, first out.
01:11
First in first out, so an example of q, for example, could be when people are in a line for something, right? so the person that comes first, right? so let's say we add one person into the q.
01:26
Right, so this is the front of the q.
01:29
The person just went to the front.
01:30
This is the back of the q.
01:33
When we added someone, we added someone to the back of the queue, which just so happened to be the front.
01:39
So this person is there.
01:40
Now let's say we add another person to the queue.
01:42
They will be added to the back.
01:44
This operation is called an on queue.
01:47
Right.
01:48
So they're added to the back.
01:49
This is person one.
01:51
This is person two.
01:53
We can keep adding people to the back of the queue.
01:57
Right.
01:57
Let's just say we add six people now.
01:59
Let's say the store opens and the first person wants to buy something.
02:03
So first in, right? so first in was one.
02:07
So first out will also be one.
02:09
So this operation of one leaving the q is called dq.
02:14
So now one will leave...