 worker, working as an assistant professor in computer science and engineering department at Walsh Institute of Technology, Solapur. Today, we are going to learn Q using STL, learning outcomes. At the end of these sessions, students will be able to perform different operations on Q using STL. So, Q are the type of adapter which works in a FIFO manner, that is first in first out manner. It supports some operations like push, pop, front, back and sides. So, actually this push, pop, front, back, elements, these are the inbuilt functions which we will also use for the stack. But in Q, what we will do? Like Q will have the NQ operations or DQ operations, right? So, NQ and DQ are nothing but the inserting and deleting the element from the Q or pushing or popping the elements into the Q. Basically, push and pop are the operations which we are going to perform on the stack. But here, we will use push and pop operations to perform the Q operations also. The main concept behind the Q is what? The first in first out manner, okay? Let us see. So here, we will have this hash include Q which allows us to include this Q template. So, let us say, I will have one Q instance which is going to store the integer values. So, now if I want to insert some values into the Q, at that time here, we need to perform the push operation. So, now here Q dot push and Q dot push 20, Q dot push dot 30. So, this Q is the instance of Q which allows us to include the values into the, this specified Q, fine? So, after that, let us say I want to display the elements of Q. So, here show Q is the method which is written by us only and which has a single parameter as a Q which is going to take it here, right? As a Q1, as a parameter we are getting here. So, now that Q1, we have assigned to this SQ instance. That instance is again Q instance, okay? So, now till that particular Q is empty, I am going to simply print the values, fine? SQ dot front, then SQ dot pop. So, simply pushing the value, print the values and popping the values, okay? So, let us see here. So, see what we have done? 10, 20, 30 are the values we have inserted, right? So, let us say if I want to perform Q dot push of 100, fine? So, here what we will get? See, 10, 20, 30 and 100. So, at the end we are getting these values, right? Fine? So, let us say the other operations. Now, if I want to print the total size of my Q, so here they have given Q dot size is the inbuilt function which allows us to extract the size of the Q, fine? So, let us see here, what it is going to return? So, it will return the Q size 4. See, we will have 0, 1, 2, 3, sorry, 1, 2, 3, 4 elements. So, the size of the Q is 4, fine? So, now if I want to extract the front element of my Q, okay? So, how we are getting then? Q dot front is the inbuilt function. See here, Q dot front is the inbuilt function, right? So, we will extract the first element. See, the first element of our Q is 10. So, here Q first element is 10, fine? So, in that way if I want to retrieve the 10 element, last element of my Q, so Q dot back. So, this Q dot back will element the last value, see here, fine? So, we will got the 100 because this is the last element inserted, fine? So, let us say I want to perform the DQ operation. It means I want to delete the element from the Q, right? We cannot delete the in-between elements in our Q, right? Because the first in, first out is the technique which Q is going to be used. So, when I will perform Q dot pop operation, so at that time what we are expected to delete or remove the element, the 100 or 10, right? Because here we have inserted 100 at the first and then, sorry, 10 is the first element we have inserted and then 100 is the last element, right? So, which we are expecting? If I will delete this 100, if our code is going to delete this 100, means what? The last insert, inserted value is going to be deleted, right? Means last in, first out, that is not the Q. So, Q is what? The first in, first out, right? So, first which has come 10? So, the 10 should be removed, right? So, let us see here, Q dot pop and we have done the show, fine? So, see, these are the element, first we insert a 10 and we have performed the pop operation. So, after performing this pop operation, this 10 should be removed from our Q. So, let us see. Now, here we have displayed our list. So, in this list we will have only 20, 30 and 100, the three elements, right? Means this 10 from the Q, that is the first or the head element from the Q has been deleted, right? So, let us say, after performing this pop operation, now I want to perform the push operation, right? Q dot push of 40, I want to push the 40 element. So, where we are expected to put at the place of 10 or after this 100? Let us see what all code will say. So, see here, after performing this push operation, what we are getting? 40 after 100, right? Means what? That inserted element is going to be stored in the last position in our list, right? So, see here what we have done? We have done the push and then show Q, right? So, in this way, we are going to perform the different operations on our Q, fine? So, let us think and write. Is it possible to delete any element from any position, from our Q, from any position? Think, it means what we are going to see? Say, like we will have the 10, 20, 30, 40, 50 and I want to delete the 40 element from our Q. Is it possible to perform this operation? Think, no, right? Because you delete the elements only in first and first dot manner, right? We have already seen this concept, right? Here. So, when I am going to insert the values? So, it is going to inserted in the sequence, right? 10, 20, 30 and then 100. But when we are actually performing the DQ operation or delete element, that is your pop element, right? Pop, right? So, expected is what? Delete the last element, no, the first element, the head element from our Q, right? So, basically here push and pop are the two methods or functions which we will use to perform the insertion and deletion of the element from the Q. So, now to delete a specific position, specific element from the Q, do we have any add position or add delete add or pop add method in our template? No, right? Because that is not specified in our standards. So, that is not possible by using this pop operation, okay? So, we cannot delete the specific indexed element from our Q. We have to follow the standard rule that is first in, first out. References, object oriented programming with C++ 6th edition by Ibal Guru Swami. Hope everyone is getting these concepts. Thank you.