 this queue in a data structure. So these are the learning outcomes. At end of this session, the students will be able to demonstrate queue in a data structure. So let us start with the topic that is the queue. So the queue is the data structure where the elements are added from the one end and removed from the other end. So when the first element in the queue is known as an front, the position of the last element is known as an rare. Now, suppose this is an array where the size of this array is four, that is a of zero, one, two and three here, the front will be pointing towards the first element in the queue and rare will always point to the last element in the queue. Now, whenever you're going to add the data to the queue or the item in the queue, so insertion of an element is carried out from the front rare end only means always when you are going to add the data, it should be added from the rare end. The deletion of the element is carried off from the front end. So whenever you're going to remove or delete the data from the queue, which is done from the front end only. So the queue is known as an first in first out that is FIFO that is, for example, the queue whenever the student comes for depositing the fee at the counter, which comes from the back end that is an rare end and deposit its fees after depositing the fees, it leaves the counter from the front end. So whenever the next person comes for the filling the fees, it get added towards the rare end means one after the other. So by getting the service, the whenever is going to over the service, it is going to leave from that place. So that's why the queue is known as an first in first out that is FIFO. So now we'll see the queue operation. So there are two main basic operations that is NQ and DQ. So the NQ is nothing but where the data is going to be added in the queue, whether the queue is the removal and atom from the queue. So while doing an NQ operation, we have to check the condition is full that is the queue is full or not. DQ, when you're going to remove an atom from the queue, we are going to check this condition that is is empty. We are going to check that the queue is empty or not. So we'll see in detail now the NQ and DQ operations. So let us see now the implementation of Q. So what will be the initial state when the queue is an empty. So we have taken the size of NQ that is a of zero one two means the size of NQ will be three. So we can insert three elements at a time now. So at that time, the front and rear will point towards this position. The front will point at a of zero and rear will point towards minus one here means that this condition is known as an queue is empty and Q operation. So whenever you're going to add the data that is equal to 10, so the 10 is going to added from the rare end, which comes and sit at this position that is a of zero, that is front will be at same position that is a of zero and rare will be incremented from minus one to plus one means whenever we are going to add the data in the queue, the rare is incremented by plus one. So the rare is incremented from minus one to zero here now. So that's why this is first and the last element the queue. So the front will always point towards the first element and rare will always point towards the last element in the queue. Now suppose if you want to add the 20 at this queue here, so what will happen the front will be at the same position but the rare is incremented by plus one means what happened. This is the first element and now this is the last element in the queue. So now this is an NQ operation. So whenever you're going to add 30, so the front is kept at the same position, the rare is incremented by plus one now. So this is the position of the queue. So front is pointing towards a of zero and rare is pointing towards a of two here. So now the queue is full here in the same manner if you're going to do and DQ operation, DQ operation is nothing but you're going to remove an element from the queue here. So while deleting the data, so the first element was an 10. So if you want to delete that data, so the front has to be incremented by plus one. Now 20 will be the first element in the queue. So that's why it is pointing towards a of one that is 20. So this is the same way the rare is going to kept at the same position. It is not going to be incremented or decremented while doing it DQ operation. So if you want to delete one more data from the queue that is and delete data 20. So the front is going to be incremented by plus one and rare is kept at the same position that is front is now at the 30 showing at that position a of two only. So if you're going to delete one more time, so that will be an empty queue here that is delete 30. So the front and the rare will be point towards the initial position that is front is equal to zero and rare equal to minus one means what now automatically your queue will be in empty state. So the front and the rare will be re initialized to that condition that is front equal to zero and rare equal to minus one here. Now after this pause this video and answer this question if you have understood that. So what happens if we perform NQ operation and there is no space to insert. And what happens if we perform the DQ operations and there is no elements to remove. So what will happen? So the answer is here in the case of this array, the NQ operation is not possible and this situation is called as an queue overflow. So that's why so while performing this NQ operation, so every time we have to check this condition that is an full condition check if the queue is full. If the queue is full, you cannot insert the new element here. So while doing an NQ operation, every time you have to check this condition is full. If this condition is not satisfied, then you have to do an NQ. If this condition is satisfied, you cannot insert the new element in the queue. In the same manner, what happens if we perform the DQ operation when there are no elements in the queue. So DQ operation is not possible. And this situation is called as an queue underflow condition. In the same manner, if you delete the 30 so that the front pointer and the rare pointers are pointing towards zero and minus one respectively. So if you try to delete the elements from the queue, what happens? It shows an message the queue is in underflow condition. You cannot the delete the elements from the queue as there are no data in this. Okay, so that's why while doing an DQ operation, so we have to check is empty condition. If this condition is satisfied, you cannot remove an item from the queue. If this condition is not satisfied, you will be able to remove that elements from the queue. So we'll see now what is the front and the rear of the queue. So to keep the track of the first and the last data of the queue, and integer variables front and the rear is maintained respectively. So the NQ and DQ operations are performed with the help of front and the rare variable only. So when the data is include in the queue, the rare variable value is incremented by plus one. In the same manner when the data is DQ in the queue, the front variable value is incremented by one size is the variable that the maximum number of data can be NQ in the queue representation of an queue queue can be represented using only one of the following of the data structure that is using array and using a link list. So in the next lecture, we are going to see the implementation of queue using an array. So why we are going to for an array, which is very simple to use and easy to understand array of fixed size and integer variable of front and the rare are needed to be implemented using the array concept here. So for link list, we have to make use of and pointers here. So later on, we'll see this. So before implementing a link list, we are going to see using an array here. So these are my references that is I have used the books that is seen depth that is by the which is the good and this is the side which are going to be used for the references. Thank you.