# DAA 30 Aug Lab

- **Course:** 5101 - Design & Analysis of Algo
- **Recorded:** 2026-08-30 00:00
- **Transcript:** 1122 segments, 12412 words
- **Made by:** deepdml/faster-whisper-large-v3-turbo-ct2

---
Yeah. So what I was talking about is we'll see today, like, what are the types of queue also? Generally, we have a four types of queue. Okay. Yeah. Kumar Devi, I already opened the tech test lab too. Okay. You can check and let me know. I don't have any access of a Moodle administration. Okay. So I couldn't able to say that whether you can able to access it. the video or not for that you have to contact the cp okay so yeah so i don't have access the right for the subject could you please let me know who should i contact you should contact the cp okay you should have a mail of a cp right whenever you applied for this course uh they do have a cp right so yeah Good morning, Akhil, Lipshika, Mahesh. When the assignment... Okay, so Sanjay, assignment will be not visible in the modal portal. I'll provide you one Excel safe link where you can able to access these hacker rank assignments, including all the link deadlines and the summation link,

right so yeah let me save my screen and start the class today so this screen yes okay so as requested by kumar devi i opened the lab to test lab so anybody can able to access this link okay let me save you this link also of a today's lab class let me spam it over here hey by the way some Yadav is there I don't know some Rohit or something last time he mentioned that I am telling so many okay okay okay so he got frustrated right yeah as Priyansu said yeah sure Harimon you can able to catch up all the classes if you will go through the previous classes maybe it will take some time Sunil okay so yeah let me start the class so there is no any like a i i keep it simple the questions also okay if you see if you will go through this question hey there is another challenge wait a second ah shit okay i didn't add another challenge so so yeah sample sample save the changes okay here you can see also how i'm adding the challenges add challenge so yeah you can able

to see now if you will reload it you can able to see two of the problem i've added now uh so let me save the changes yeah okay so let's first go through this queue okay so what is queue why is queue okay another thing while i was explaining okay and also i'm explaining i couldn't able to see your chat screen okay whatever you're sharing okay i'm setting the link again control a control c whoever joining now you can able to access through this link yes this is assignment okay so what is queue queue is like in the real world you see there are many places correct uh like in a railway station or like in the railways also a little bit not tracks but the trains okay and the task waiting for a cpu okay here i'm talking about the synchronization task not the async one okay so there is a difference between the async task and the sync task okay so in the async task okay you can able to parallely run the two of the operations

okay and in the synchronization task one task is depend upon the its previous task okay to complete so this is called synchronization task and the async task is like a parallely you in hd group if you ever like a if you the 266 students joined okay uh except two one me and one the mentor okay so 264 students and if you ever develop any android okay there is a concept called the coroutines okay where we can uh where we are using coroutines for the asynchronous task let me give you one example while you are loading the one page okay so there is you can see in the main thread if you can load you can load able you can able to load the uh the ui things like loading screen things and behind the that the which was requested okay the service you requested it will bring to you okay so there is a two task running one the bringing okay bringing the service from the backend api another one is loading the screen so this is called parallel execution which

is asynchronous task okay synchronous task means one job has to be complete then other job will be complete by seeing the previous job is yes completed correct so yeah so this is called the queue okay so where like a uh and many example if you see there but in the programmatically we have four types correct the simple queue which is also called as a linear queue okay uh then the circular queue which is again the why it is discovered because like a the one disadvantage of a linear queue which is a which is a wasting memory problem okay there is a one disadvantage of a resting memory problem okay so there is a one disadvantage of a linear queue wasting memory problem so that's where circular queue is uh came okay and then the priority queue cam okay the priority queue means in the overview if i'm going to tell uh the high priority numbers will be went out okay the low priority will be uh the they will process later on okay this is used

in like if you see in the operating system the jobs like a high priority jobs will be in the first low priority jobs in the last correct so this is uh they are using the priority queue behind the same double-ended queue okay so we have a queue like this okay okay so if you cannot able to relate what is q let me show you visually okay so there is a people a line of people like a one two three four five six seven okay and there is a friend okay and there is a rear the rear means last okay front and last who cannot able to understand what is here uh there is a front there is a last okay so how q works uh this first question will go out then second person will come the second person will go out the third person will come okay like that it will go in a sequence cell it is called the double ended sorry i mean linear cube correct this is linear cube what do i mean by double ended q means you are only getting out from this way okay

this way this way okay but you can able to get out from this way also okay so there is a double end okay we have a double exit you can say okay you can able to uh went out of the like in any of the side okay so that is called the dependent here we have four types correct so these are the four types we will go through one linear queue okay in the rest of the classes we will go through uh we'll go through all of these three of the queue not only in the conceptual manner but we will solve the problem also in the logical a okay and uh we'll solve also stack problem correct so i have to start the queue okay and that's why i didn't included any of the stack question in the today's class but in the next class also i will not include the stack question but in after the next class i'll include stack queue both and another new concept will be there correct we'll go in this manner correct okay so hope you understand up to this okay uh what next

then next we will go to the problem statement okay so in the today's problem statement you will learn about the split concept okay and the for loop and some if else concept right using q okay so we will solve the first question okay there is no complexity of the question let's see so the question name is like a ticket counter q2 okay i don't mean to be two but it came i don't know why you are managing the ticket counter okay customer said i one by one and stand in a queue okay i'm saying okay okay that guy is not having any problem right so each customer has a unique customer number and the q follows people another concept is there q always follows you always follows before what do i mean by before order is first in custom who cannot able to understand what is this and what is this rule is okay so there is a this is the rule of a queue okay uh so uh question for softness you will see here okay accept the double-ended queue okay if you will see here this is first one it is in inserting

from the rear okay rear means let's say insert okay first tiger take care correct where stack follows stack follows the lipo concept okay stack okay last in first out last you know the first coming back to question the cube always follows before you are given n operations each operation is one of the following nqx dq and front okay there are three operations why i haven't taken the rear or last operation because i do not want to consider the circular q now okay there is no requirement of that. That's why I am not considering this rear value or something. So perform each operations according to the rules below. Enqueue is like defining add customer x to back of the queue. We are adding from the back. DQ means remove the customer at the front of the queue front means print the customer currently at the front okay who is ever at the front we are gonna print it okay if dq or front is performed when the queue is empty print empty

okay so there is a two cases okay i have also like given the edge cases you can see okay this this is at success point okay so if the dq dq means up element ko nikaal rhea ho thik hai aapne q se or front thik hai aap front element ko define karee ho okay agar api define karee ho jab thab aap q agar aapka q empty hai to aap empty print karo thik hai yeh bholna zha raha input format kya raha ega input format will be the first line contains and n integer means the operation you want to perform. The next n lines contain one operation each. n defines 1 to 1000 means 1 to 1000 operations you can perform which is in the test cases and the x which is a number you can take up to 10 to the power 5 means you can starting from 1 okay and take up to 10 to the power 5 okay the output format will be for every dq or a front operation print the required result on a new line okay we have to print it in a new line correct okay so i am not printing while doing the operation of a nq of a x okay nq means

inserting of an element okay that's why i'm not hitting that if you will see simply see the input format okay the input format is like a 8 which is defining all the 8 operations in this okay and then defining the operations like dq and q of a 5 and q of a 15 front then again dq front then again dq and friend okay what does that mean it means like a you are printing first empty which is first we are not entering anything that's why we are printing empty then we are entering five okay oh sorry okay i'm printing also thank you for five that's why i'm printing the five nq for 15 again that's why i'm printing 15 in the queue we have two elements for now which is 5 and 15 correct then again we are printing the front okay uh it should print could print like a 5 but i don't know okay let's solve the question okay so these are the question also okay i think there is some mistake okay they have to print the front means like you have to

print the five because in the front element we have a five then again dq dq means you are uh either there is a correction in a operation or we have to correct in a output values okay i'm apologizing for this oh this mistake i think in the front we have to print five and then then again dequeue means uh okay okay got it got it okay so in the end as i said like i am not printing in the enqueue operation okay so what happened like when you're printing the front okay it is showing you front value okay when you are dequeuing okay means you are outing the 5 okay unless there is only one element called 15 5 is out you dequeued okay then again you are printing the front again it is printing the 5 okay again you are dequeuing okay you are dequeued means it is a empty you dequeued that okay and again you are printing the front okay there is no any element for now that's why it is printing empty okay hope you got my point

and in the second example you can see and you can understand that we have a seven operations following by this and in the enqueue you are doing 10 20 30 okay and then in the front you are printing the front value which is 10 you are decoing means you are outing the 10 okay and then you are printing the front again which is 20 and then again you are decoing means there is only one element called 30 okay we'll go back to our blackboard okay ticket counter ticket counter two items anything okay so how we will solve this question just wait a second so we have to write like a uh we have to write like in a string we have to take the element in a string which is nq uh dq something like that then it will check like if the string is nq okay nq of x something then insert otherwise uh if it is it will check for like a three of the operations okay then uh you can print that okay so uh solution will be goes like this so first what we will do okay uh so first of all before going to the question we will use uh

Sarada, I will take your doubt after this question. So first, I am using predefined library of a python then in the third part, after solving these two questions, I will go through you that how to build a queue from the scratch using array okay so first i am using from collections import dq okay so what does it mean is there is a collection library where dq method is implemented okay or dq class is implemented where in the dq class there are some operations like a nq dq okay and the friend okay these are the operations are there we are going to use it close okay so this is does mean okay then we are importing the n value okay what does it and means the n operations right how we are importing using input function okay i'm taking input okay then q for q equals to dq okay so as i said this must be a class that's why i'm creating one value okay you can say variable okay i don't know who is the ramesh he asked for like a five to seven times

like a for the admitting only is it a ramesh from the five stars ramesh and sures uh so yeah they what is it means like so yeah as i said like a dq might be a class so that's why i'm creating one variable why i'm creating one variable because we can able to use those functionality of like a q dq and q dq front so these are the operations we can able to perform so that's why i'm creating one object for that we cannot able to directly use this dq okay that's why i'm creating one object for this okay so for uh dash okay why i'm taking the dash is for i in a range you can able to take but i'm taking as a dash okay so something we have to take different okay so that you can able to understand we are not sticking with the i or like a j or any variable name okay so we can able to take like this also okay nice ramesh welcome again yeah seven time uh then uh for dash in a range uh of an n okay means we are taking the input or like

operations up to seven times or eight times whatever the n times okay means up to the thousand times okay as constant is defined up to the thousand so thousand times we can able to take and then i'm taking the operations okay operations sorry operation equals to include of split okay so why i splitted means okay so i'm giving one example let's say i so better take nq okay so i put like a nq oops okay nq of x okay so while defining the nq we have to give one value right so uh the nq i have written this okay then i'm uh then in the space i am writing x okay so i written here like a split okay so when it will so what does it means like it it will so now operation is act like array okay where in the operation okay in the operation sorry in the operation we have like uh zero and one value okay sorry don't take like that in the operation we have something array okay acted like an array right so one value is like

nq another value is considered as a x okay correct so after the splitting okay it will considered as an array okay where the array value contain one is a nq okay which is a zeroth value okay zeroth value and another one is a one value okay so when we are operating okay so these all are considered as a comment okay i'm removing like this i'm putting it here for now okay then when we are performing one operation then how we will do we will do operation of zero which is nq okay if this is equals to equals to is that nq okay if this is equals equals to nq okay because this is the zeroth value right so i'm checking like if the zeroth value is nq okay then what we will do we will simply insert correct so i'm taking the value as a x okay and then int of okay so this must be an integer correct so whatever you are putting okay into the array this must be an integer okay so that's why i'm i'm taking one uh x variable okay and then uh

and then i'm converting into an integer okay what i will write operation of one okay convert into an integer and then q.append okay we are as i said like we are created one object okay so this is a variable or like an object you can say okay so this variable we created to use this append function okay so what does it mean in the collection okay collection is a you can say is a library where dq class is there okay in that dq class there is a function called append okay where if i will call that function okay i'm not writing this but where you will call this function okay the element will be appended to the last okay hope you are getting my point okay then else if okay else if means why i'm writing this because we have two more operations right one is a dq and another one is a front that's why i'm writing else if i'm checking again okay but if operation is a dq operation okay if operation is a dq operation if okay

Okay, if the Q value, okay, so first of all, there is edge cases what I have given in the question, right? So if the Q is empty, then we have to print empty also. If that is not empty, so we have to write two of the condition, right? So DQ means we have to pop out the element, right? So there is a one condition of a pop out, another condition of a checking, okay, if the empty is not, okay, so we will write two of the condition. Okay, so let's start with the first one. so if q okay okay so i don't need to check like a if q is equals to equals to something like that so if i will write if q only okay it will check okay it will check like a uh it will give like a boolean value okay so it is a true or a false okay so if the q is a true okay if comes out the true means like a what you can say it means like some value is there in the queue correct then in the dq operation what we will do we will pop out okay we will write like a there is a

there is a function called the pop left okay by left we are popping out from left side right for now correct you can imagine then the second condition else okay sorry else okay we will print empty correct okay so this is the second condition l if okay the third condition okay alif if the q is operation is a front okay can we able to write in any other way except if alif if alif yes we can able to write but that is called the switch case okay so there is a switch okay uh in the simple term there is a switch if you will pass it the information there okay it will switch to particular case okay so under the switch there are many cases written okay i'm showing you that also okay so this is something different i'm writing okay what is different i'm writing so there is an alternative way to if l if you fell if you fell okay so what is that switch case okay switch some case is there okay some case okay so this

is general case and the condition written in like case one some condition case two some condition case three i'm sorry case three okay some condition otherwise break okay so in this way also you can able to write this okay for the simplification manner i'm writing okay that's manner hope you are getting my point then if q okay if q okay so in the front also there is a two condition if the q is empty then we don't have to print we have to print empty and the q is there okay then we have to simply print q of a zero okay so we have to print the front value right we have to print only the zeroth value so i am writing this again one two three four five okay four okay so this is the zeroth value this is the one value this is the tooth three okay and we are popping out from the left okay so first one if i will call the dq operation then it will pop out okay then uh if we will like then the q will be two three four correct

so the front value i'm printing is like a zeroth value okay correct hope your returns so i'll write like a q of 0 simply fit else print of empty okay print of empty so this is all about the this like it's the first question okay uh if you want to try it on it then i can able to so let's say you put it the seven operation okay and then it will call and the operation will call okay and let's say you are putting the operation as a and you okay another another thing is there okay while you are putting the split okay it's that split while you are putting this plate it is by default splitting by your space value okay so let's say you written like nq space x something okay so this will consider space as your like a splitting okay and then it will split by your space if i will write like this okay something like comma okay there is a comma is there something it will split by comma if something you are putting like something this okay it will split

by this okay so by default is like a space okay so operation is like a uh you are putting something nq of a 10 okay then operation will go operation will go of a zero and then nq sorry i don't know why am i spreading mistake is there any n cube then operation one will pull like 10. hope you are getting how this is rating works okay correct so yeah this will go and then this will check if operation of a 0 is a n q then first convert your operation of 1 into the integer then append into the q okay then 20 will come then it will also append if you will do the front okay then it will pop left okay then if you will print the front then it will bring the front value okay so it will goes on correct so yeah i'm copying this link i'm setting it to you understand this okay then ticker counter having the scores equal to zero even after submitting okay uh i don't know why can we write operation equals to input outside equation equals to input

now that's what i am doing like operations equals to input only okay okay i'll take the take the doubt first okay okay please don't ask the irrelevant doubts okay muhit do you have any doubt this is a simple question only yes my doubt is not regarding this uh code my doubt is regarding when you told that circular queue right into the circular queue how it will be lethal that i didn't get it no i didn't introduced even circular sorry sorry fifo but let's say you told that q should be in fifo manner right so if you should be in fifo manner and then circular you told that circular we can i mean take it out from the both then that's the circular right no so how the double ended become then i mean fifo if we are taking from yeah i'll introduce that also like in the next classes just just next next class i'll introduce that okay yeah just you know the concept like a double-ended queue means like a both of the side equivalent okay okay yeah okay thank you and you

know why this double and why these four types of queues are introduced because of like a different different use cases okay so if i'm going to tell you one um priority queue okay priority queue is introduced because of a os okay system memory of a higher job queues a higher job will go out first then lower job will go in the end okay so there are different use cases are there that's why they are divided into into a four types of a queue so that's not no thank you yeah okay thank you mohit uh abhishek pal okay hi abhishek he is not a ayush kumar and he is also not a subrati prey can you uh can you just scroll below to the problem that you have soon just now yeah okay stay over here so what does this actually does this operation equal to input dot split so see we have something suppose we have given n equals to 5 so we'll have five operations correct suppose dq and then nq5 nq10 so nq5 that's a single operation

so operation input dot split will actually be splitting that dq and nq5 nq10 correct so then again how are you splitting it into nq and the number five how are you splitting that because operation zero is can't be only equal to equal to nq it can be nq and then a value isn't it nq and then a value so this is the value okay so operation one will be the value and operation zero will be the nq what is your doubt no operation zero will be dq and operation one will be in q5 kind of thing i guess what what operation operation zero operation zero will be dq and operation one will be in q5 operation two will be in q10 isn't it oh you are confused okay i got your point oh what happened okay so you are not inputting the at a time okay you are inputting one by one only so that's why it is in a follow correct okay you will go to first element okay so yeah you are if you are confused okay let's say five okay i'm sorry it is a five okay so it

will call first one okay which is a one for i in a range of a one so means we are inputting first operation okay what is that for first operation is like a nq of a five let's say you have taken okay then you are like a splitting that nq and the five okay then you're inputting another mission okay then you're going to go going like that okay and what is okay so i'll explain after i clear in all of your doubt okay and explain one more thing okay what is the memory wasting problem that's only i'm going to explain hope you thank you actually yeah this is from python so i'm not i'm not much experienced in python okay thanks that uh got it got okay no worries you can follow the campus x video you can able to click it saradha tamat hello am i audible yeah you are audible yeah sorry i think my net was shaky so i got off in between and uh i was asking that in this the input is like we input and then there's an output and

then there's an input and then there's an output but the question is asking for all inputs together and then all outputs together if i've understood correctly all in oh yeah all input together and all output together what does that mean what i mean to say is in the question the way the sample input is given is that there's eight and then there's dq nq dq nq nq and then there's sample output but this code the way it runs is we write dq and then it gives the output of empty and then we write nq5 and then it gives an output of five okay so yeah okay you understand yeah so now what happens is that we are not doing one together if you will see so we have to understand the code we have to not put the elements together let's say let's say let's say how to tell 5 I have taken it and then 10 I have taken it and then 15 I have taken it and then 3 values I have only now I have to do it I have to do it I am not doing any deque, I am not doing anything, okay?

If I think that my next operation is going to be a deque, now I have how many operations I have done? 3 operations. NQ5, NQ10 and NQ15, yeah. Correct, okay? 3 operations. Then, if my total number of operations is 5, okay? If I think that my total number of operations is 5, okay? If I think that I have deque, okay so he had to go yeah okay yeah operation okay yeah total number of operations were 3-4 operation yeah front use okay front value print okay After 5 operations, the loop will be out of the loop and the loop will be out of the loop. Yes, I understood. I was asking that if we will write NQ, then we will write NQ, then we will write DQ. I will start again, if you have a dequeue in starting, and your empty, then you have a dequeue in starting, so obviously the array is empty, okay, so it will be empty, and how much is your total number of operations? 5 output one yeah I understand what your concerns so you didn't understand that

this is like but I had considered that you can give so many number of operations it doesn't mean that it will go in and come in you can give it one one I said I didn't give it one but I have just put it in one Because we had input with each other, the question was given in the previous class. So what do I have to do with that? I have to go out and go out and go out and get input.split. Then I have to go in a for loop, what do I have to do with that? For I, operation, something like that. I have to save it with one-click and save it. Correct. So that's why I have taken it. Okay, I understood, but what would be the right way to get everything together? And what is the question? The right way to understand the concept is the main way. The way to understand the concept is the main way. You can use the input together and then you can use it in the for loop. After that, the final output will come. That's not as true. I mean, this is just easy, because if we take it out, then there will be two components for NQ and X, but DQ will be one for DQ, so this is just easy.

Okay. Thank you. Asushi. Hey, Adilta, good morning. Yeah, hi, Asushi, good morning. Adilta, this is not per se a, I mean, there is no doubt, but I think there is some technical issue, because you have ticket counter q2 30 marks allocate and so far 133 of us has solved and none of us has even got I mean any score zero okay okay no worries because I have the submission marks review not in the terms of score I thought there is some technical glitch that's why I thought of raising this with you ah nahi oh kya nahi kalmai isko jab solve karadha kutse bana ke test cases to meravik kuch wesa glitch to nahi bhol sakte some meray taraf se kuch error hooga okay test cases mein to isko oh marks assign nahi karpa raha achi ase okay pata nahi kyo so haa my uske hesaap se lelunga so okay okay i just wanted to highlight this thank you. Yes. Okay. Thank you, Asu. Mayur Naran. You are audible. My doubt is about the split

of function that was being used. Okay. So, okay. So this is the, this is your doubt, right? Yes. So, some for loop is there. Okay. And then under that I written like this. Okay. So, jubhi, achas, it's got a the operation. Okay. So, he concept format can you say format I mean that integer how integer I know he he हो तो ही स्टिंग फर्माट ना आया अगर आपने n qf10 दिया ठीकिन लाक तिस कि क्यूंकि मैं dq प्रण नहीं ले रहा हूं क्यूंकि इसमें इसके प्लेट आपरसिंग का कुछ भो नहीं है समाझ नहीं सकति है सिन्हें so let's say input liya aap nai aapka aipka aipka strings format me aapka aipka yaad rikhiyega to us ke baad agar ham dot split karein input aya input ane ke baad dots agar split karein isko to by default mainne kya bola tha ki space ke hesaaf se wo split I am I correct so now who is the operation operation store when the operation store but the store now array because two store now what will underneath it was a key is that it's a split right now I'm going to store it now I'm going to store it

so if I'm going to store it index follow the zero based index for the first index zero and then index one so this is okay loop operations of zero check operation loop hope you hope i am clear to you yes okay thank you mayur i think he is not there um sorry i have a doubt regarding the problem statement that you have given in the hacker rank it is basically saying that dq operation would print something is this something related to what's the uh element that has been dq to print out um okay output output format foreign If I can print it Yeah, but my friend's name II I will go All right, I'm T. A. That's it. It's, it's a print But I'll find it It's print It's in here Okay, so now I was empty print clarification okay I got it front print empty sorry only left and leave it and leave it and leave it and leave it and leave it and leave it and leave it okay thank you that's very concerned okay thank you sir of varun kumar agrawal hi sir um this is

my first lap so i may need to take your previous lip hopefully some of the courses which i missed i can do it it will be open number one number two sir um no i understand that you wanted to take the values one by one rather than this if we would have taken it through all at a time then I we can we can create two queues correct one is for operations which will which will handle all your requests from the user and the length of the queue will be the equals to the first element that you are passing that is like input that eight or five or six number of operations you want correct and then i will take another queue which is which is basically uh another for loop another for loop for loop yeah which will which will work like it um which is which will do actual operations actual what is come is it correct way uh this is only the correct way that's what uh saradha also asked like there are yeah there are two ways okay so what we can say

But if you are confused that you are taking one with each other and then you are coming Then you are not doing it That you are doing it After you are doing it If you will compile it Then you will perform it After you will perform it After you will show it If you are not doing it Then you will do it After you are doing it And you will do it So like that it is happening okay thank you thank you Varun Jitendra Kumar Verma thing is not there I'm sorry now you can speak yes sir my dot already got cleared in previous questions my doubt is like we have one operation for front so is there any operation for back or rear like if you want to print so yeah as i already told okay so the question if you see we are taking only linear q okay so the q follows only the people okay so that's why i'm not considering the rear or any last element for now i'll consider it in the next class i'll teach like a three of the circular queue priority queue and the double ended queue in that i'll take those

second thing like whenever we get any data structure problem so it will be stated like you have to solve with the queue or it we have to analyze like we need to so in that you have to analyze like a you have to also like an interviewer can able to like a hint Okay, you can solve it, but you need to know what it looks like or what it doesn't look like. You can read the question and understand what it looks like. If you know the line, correct. Thank you. Prakash Chandraja. Good afternoon sir. first thing is that we can use a multiple operator can you share the operator okay so we have we can use multiple operator like a append pop left okay and you can print okay from the collection okay but we can also use uh can also use like what else like a front yeah go ahead yeah Ganesh Gupta. Sir, I am audible. Yeah, you are audible. Sir, pop left is a function or something else? How we can define it? So, it is already defined, you know, need to. Okay. And it is coming from like a collection library.

In the collection library, there is a DQ class is there. In that DQ class, there is a function defined for the pop left. okay so in that pop left there is a logic written like that the array will uh the element will be popping out from the left side okay so this is how if you will call that then it will work like that so okay sir thank you thank you anand kupta yeah good afternoon uh like as we have studied about this concept can we have like where we can use this concept and why this uh concept have been originated like from where so as i already given you the real world example okay so if you will see the if i will give you some real world example uh the applications in the bank okay which are coming okay in that applications or any list okay which you want to do okay after one by one okay and in the tickets also okay so something like that if you will uh go to the irctc okay so there is a first first in passed out concept applied there okay and also they have used some radius okay

which they are calculating in the milliseconds okay fraction of seconds to get your ticket okay and after that ticket the seat is filled then after uh another person will get filled the ticket okay after that so in this okay so you can and if you will if you want to explore okay there is a concept called okay in the in the python also there is a concept called threading okay as i am coming from the android background okay i'm i'm python also there yeah there is some threading and then android kotlin there is a protein concept but i accepted to aml okay recently but in that you can able to see how this is working so yeah this is where you can use the queue yeah thank you okay Nehan Pera oh yes I just wanted to know that you have taken under collection the queue if you could scroll up yeah So, DQ which you have named it under the variable name, is there any other thing which we need to import or is it this DQ only because it's confusing with the word DQ which you're using

for removal of the element down. No, there is only a class which is defining of the Q only, Q concept. the collection only you can able to import okay but if you want to do like if you want to do like custom something where we can do okay we will do that also okay in the today's class only and we can depend and you can able to see okay so and so one more thing um q uh dot uh pop left you've given is there any other function more which is there in that like uh yes right okay Okay, pop right is also there and other functions like I couldn't be able to remember something pop left append or something. I couldn't be able to remember something. There is a pop only. The other functions are there in the DQ collection. I don't know. like a search okay yeah there is a pop only okay there is a push okay these are the stack okay these are the functions are there okay so they define like a ydq name as a double ended cube

we'll study the double ended queue in the next class though i'll get you there okay sure thank you sir thank you now okay so we'll continue with the next question um okay uh so the next question is like a printer receives the document from the different user and each document has a job id the printer processes the document in the exact order in which they are received okay for example job is arriving like a 101 then 102 and 103 the printers would process like a 101 102 103 so you are given an end operations like a three operations is three jobs is arriving what does it mean like a each operations is one of the like a add x print next okay and perform the operation according to these rules okay add x means like adding the print job x okay to the to the back of the queue obviously and the print means print the job at the front of the queue which is like a nearly to the first question only okay uh but there is a catch okay print the job at the front of the queue and remove it from the queue

okay print means the next means print the job at the front of the queue without removing it okay next operation is like a front operation okay you can see and if the print or a next is performed when there are no jobs print there is a no job okay so if we will get like a you will see the constant on the n is like a from one to the thousand and x is you can take about to 10 to the power five okay the output format will be like a for every print or next operation print the appropriate job id or the no job okay so there is a six operation in the sample input 0 which is add 1 add 2 3 okay this is sequence okay you are printing it what is it print means like a you are printing it side by side and you are dequeuing it okay next means yeah so next means you are not removing it you are only printing it okay so in the simple input one there are also uh six operations you are adding two values which is 50 and 60 you are

printing two values which is again 50 and 60 and you are printing it okay which is you are removing the 50 okay and then you are again printing it which is a next okay which is a 60 okay value so this is similar kind of like a you can do um like some this kind of things only okay we will split uh whatever like a operations are coming okay we'll split that then we will see what is the question about this like print job application something print job is there right sorry print job you not application yeah ask the question like a uh how many if you are from angular nobody responded okay got it i'll see yeah so um again we will take from the collection only collection collections import import d cube and then again we will take the number of operation you are doing okay and then uh the q value then you are again you will take the dq we are creating one object okay up to this we are fine like that only for dash in range of and okay what does range means

like up to the n minus one it will go okay then operation we will take equals to input of of split because uh after add we will we are giving the one value right so that's fine you can also do this question by yourself okay uh without seeing that previous one if the operation of a zero equals two equals two add okay sorry uh and then x equals to int of operation of one okay then q you will be dot fn okay like that okay again we will check for the ellipse okay there is a two condition again for the print and the next right so popping this and testing it over here if the queue is like this then you can pop left right which we are popping we can also able to print it okay then we will print the if there is no job then we will print the no job okay and then in another statement we will write like if operation of zero is like next so this is a simple question only i'll not explain this okay because this is the same to the previous one okay i'll directly go to the creating the custom

um what is that next make it next name only print cut right so directly i'll go to the custom way of creating the queue you yes okay same only like this yes So like that only. So after that, we will see how we can create our own queue, right? Okay, so you will know about class and about that. Like why like a class, what is class, what is object. Okay, I think most of you know about this. yeah so if we want to create a custom custom q okay okay we required three things okay करना है निय wizard Maps देख्या चाहिए wise करना चाहिए इसको कैसे करना है requirement so remove the first element okay the third element first element so for example example repeating in the queue there is if there is a three elements okay like 10 20 30 front will be like a 10 okay if we will enqueue the 40 then after 30 it will go to the 40 right so 10 is 20 is 30 is 40 to enqueue it means it will come to 30 after 30 sorry if we dequeue that okay if we are dequeuing something then

humaree pass 20 bache ga 30 bache ga 40 bache ga take it asana chai yeh take it asana chai yeh because q follows the first in first out right ndem to eatin operation डालना है तो पहले में क्या करूंगा पहले class create करेंगा जिसमें की मेरा यह तीन operation रहेगा ठीक है कि टन class q okay def of okay तो you are getting it right मदलो कि आप सबको पता है def क्या होता है I am not a left so it I am then we are writing the dq function okay so it's not nq ho gaya nq me append kardhi value ko agar kuch bhi nahi raha like empty bhi hai yeh to append karengi to either 10 a jayegu append karengi to either 20 a jayegu then we are writing dq I am passing only self value then then it will check okay dequeue we have to check first of self.items self.items self.items the celltrot items is the value of the 0 raha the cuisine kuchh bhi nahi hai what return karo okay so when whenever we are writing the function we are also writing some return value

okay so how return be written return mtlb ki jahaan se woh function call hoa hai wahaan se wahaan pe woh value jayega okay you is empty okay else agar kuch hai kyun nahi okay otherwise we can write direct return return of self dot left side left side value 0th index items of .pop of 0 pop array function which particular element by taking input as index value okay index value then I am printing the front value let's say simple this okay haa same condition okay else okay else direct return sorry return of self.items of 0 correct so this initialize class initialize how do we do this ? then u of q what do we do direct init function init primary constructor so primary constructor invoke either function execute items create it after you call object copy paste use and nq value । इसमें वो mention हो जाएगा इसको वो call करेगा पहले function को ठीक है इसका value pass होगा इसमें उसके बाद इसमें append हो जाएगा value ओके items में append हो जाएगा value ठीक है तो इस तरह से ही collection library में dq का function लिखा हुआ है जो कि dq एक class है और जो pop left है उसका वो एक function है ठीक है वैसे ही इधर लिखा ह

you can write three of the operations okay now coming back to your questions okay okay can you give the code in the chart sure sorry yeah sure now coming back to the I think you can drop your hands I can see the repeated hand also like in the previous okay means again doubt right okay so what is my thing yeah sir the DQ I have written my function, it has 0 to return, 1 is the stream and 1 is the value that you pop it, then send it to me. So, when I call the DQ, then I can understand how to return the stream. So, what happens in Python? होता है कि data type में वो नहीं होता है लेक्ट आपको अच्छा बागी सब के language में क्या होता है कि आपको int p int a of okay 10 लिखना पड़ता है string भूल भी गया है string b of ャンプेंग करके लिखना पड़ता है सो आपको explicitly करना पड़ता है अच्छा तो एह है और तेरा जो वैल्यू रहेगा त्यरा इंटीजर रहेगा वैसा पाइथन में नहीं होता है थेक है फाइथन क्या होता है कि data type aware something so I think that term I don't know so I can put it able to okay

so you have to pass it okay so you have to pass it okay you have to pass it okay so so here I will not explicitly mention here if I write here value int of s explicitly I am defining it that int the value will come then you will give me an error or type error okay something that value is expecting int but passing like a string okay so something like that you can do okay but huh yeah is case may up either explicitly define that's it yeah yeah so hope I'm clear to you so buses yes mm-hmm Aditya Kumar yes I'm a audible you were on this cue I was asking like it it will be explicitly for list data type only the collection you have a queue as a hootahe ki list hi hootahe ya phir array saamuzh loho thik hai wohi hootahe thik hai usi usi ke upar ek rapper bana ke hum us ko q bana di ya phir usi ke upar hum rapper bana ke hum stack bana di thik hai yeh sab data structure usi se aya like inherited from that array or something you can say you can say if you have to define

like this type of language you don't have to explicitly define type check I like and I like I like I like I like I like is pop input insert operation subscribe this list can be used okay thank you Kasis Satyarthi hello hi Kashish hello I am Kashish Satyarthi so I wanted to ask one thing that which we have question number two I have run the code, so there is a test case to fail, so will it be considered that there are three test cases, but one is not clear, so do we have to do it again, or can it be considered? No, it can be considered, but let me also say that I didn't get it. Test. Next you are withiki. no job, no job, 99, no job, next khanne se no job ayega, print khanne se bhi no job ayega, add 99, add 99 me, 99 ayega, print khanne se, print khanne se then ye hat kaya, okay, and then print no job okay you can check that you I mean but I mean input and output to say okay I mean check if I mean it's not it's okay thank you Satyandri Kumar your mic

is on but okay i'm let it be like a mic on cut let him but sorry that's a network issue yeah good afternoon yeah good afternoon so like one question is with respect to if i'm having an input which like looks like a kind of text like a input as a string so what is it like the same condition can work with this queue as well I mean a kind of a plane like you have this in space yes yes okay so now I'm not going to do the conditions check current ticket I mean conditions which would do yeah fair is called values PR and ticket values or consider consider consider consider because if you can say input layer and let's say let's say hi hello like something okay event मेर Kbooks से हैahan तो क्या घर् avete वह मैने लिखा एल then I am here to be a new up to the input split right now okay correct operation input dot split so if I am split out I am so if I am add print next I will be more again that you can customize that you can customize that you can customize that okay okay thank you

thank you sanjeev kumar uh hi so my doubt is uh are we going to study linked list because earlier we studied linked list first then we moved to stack and qa uh like i mean in order we follow right so first we study list then we study area like linked list then we go to my first like uh syllabus but what i have instructed that that i am teaching okay okay okay okay okay okay like java C++, but there is a list in Python, so it's not here. Okay, thank you. Rajiv Kumar? Yeah, hi Aditya. Yeah, hi Rajiv. I have a small query regarding assignment like I can submit while using the collections or do I need to create the class and then submit because first assignment I submitted where we use the collections. No no no you do not have to make any class okay you can only import only from the collections okay so the third one I have only showed you how can you create your custom if you want to create or like that underneath the dq from collection

The function is how it is written in it, so I wanted to show it in it. Okay, got it, got it, thanks. Okay, thank you Raji. Sudhansu Sarma? Yes, hi Adathya, just wanted to ask one thing, like in the first question, I am only able to see the two sample test cases, like is it the glitch from my side only, I am not able to see the hidden test cases or you haven't put it? No, no, no, I didn't put. Oh, okay. Okay. Then it is fine. Yeah. Thank you. Usnik Nath. Hello, sir. Uh, actually, uh, I had a question. Uh, I actually joined late a bit, so I couldn't attend the first two classes. So the assignments for those I have, I think next. Uh, so I'll, I'll open that. Okay. The two of the assignment, although like i opened already uh second abtech lab test too if you have a friend so you can ask them otherwise i will provide the link so sir i can submit now so i just wanted to ask first question is for how many marks actually under okay so if there is a glitch

okay if you are not getting any marks as Asu I think I already asked like this question I will give it to the submission because I was also a glitch not a glitch maybe an error from my side okay I have submitted but then be both score me zero dikhano correct correct so for that i'll see the submission only okay thank you thank you prushna chandra surdeo uh hi aditya thank you so much for the nice session actually my query is something uh relevant because initially few of the classes i have already missed okay because due to some reason so the lab session and the configuration of the hacker saying that already have followed your uh few of the day okay i'm able to log into the third uh left whatever is the link you have posted today in the group right okay so yeah is the initial two questions whatever i missed already so how can we get back to it and any specific configuration that you have told in that recording i was following that something like names and

and you have to follow some naming culture right to clear the account so whether you can discuss about it later on if you'll have some time or can you tell me how can you use it on that okay so do you want me to repeat then um so coming to your first question okay you can go through the Moodle website and you can check the video if you are getting okay to attend the classes uh if you are missed and then coming to second question uh that like in naming convention first i told like you can name uh like a first your role number then underscore your name if that is not sufficient means like you can also put your role number only okay i'll i'll catch you from there So, yeah, you can do that. So, this account we will create. So, if already existing account is also okay, or any specific account for the account? If already existing account is also okay, then you change the name. If you have a personal account,

or like already, then you can do it. Thank you, thank you so much. Thank you so much. Thank you, Krishna. Subhi Sarma. Hi, good afternoon. Good afternoon. I had one question regarding the attendance. So basically, we have told that 75% attendance is mandatory, right? Okay. So I wanted to ask that we were told that if we watch the video also, for example the recorded video also then also from our official teams then also our attendance would be recorded so is it true yeah it's correct it's correct okay second i wanted to know that after some days can you please share with us along with our roll numbers that how much attendance every person is having so for example it's me if i got to know that my attendance is like 60 percent so i would do that so be like a uh i do not have any attendance list or anything else for that you can check with the cp team how much attendance you are having even though professor is not catching up you the attendance only the person who is at a cep they

are only catching okay so is it like if the attendance won't be uh would be less than 75 person then they wouldn't be allowed to appear in main exam yeah no i don't know about that because i i don't see any cases in the previous so i couldn't able to tell you about that you can contact with better uh cp team you can able to get more about this yeah okay also i uh i just want your guidance here i wanted to know that how to fetch my role number i have got my password and so if you will simply go to your uh you will simply go to your uh email id which you got okay so after your name or underscore you can able to simply uh up to your at the rate okay that is your roll number like let's say as i can able to see your roll number as a subi underscore pa 2607 mte 76 so pa 2607 mte 76 is your roll number okay okay thank you thank you thank you is that a three name you included or abandoned yeah it's uh no it's uh my full name my name is yeah i'm sorry like yeah yeah that's okay uh i

wanted to ask that uh i missed two of the lectures previous lectures and uh this is the third lab right so i think that that would be two more labs which are previously occurred so how can we access that because i cannot access and see on the hacker rank outside too yeah for that like i have to open the context again and if you will see the link of a lab test 2 then it is already opened I think you can able to access just paste your current lab link like a test lab 3 and just remove the 3 and paste the 2 you can able to see I think the first one I didn't open I'll open let you know okay okay thank you yeah thank you silbra tripathi and he's not there hi yeah i can hear you yeah my question is regarding that hacker rank submission that if i directly access that link that is lab one or two or three then I can I can able to visit those problem and I found that it's solved but when I go through my profile and see the submissions I

cannot see anything at my profile means if I want to see my score my submissions and the contest then i cannot able to see so i think you can able to see in your i think you can able to see in your context uh i don't know how how you are not able to access it but yeah you can able to see yeah but i don't know that if uh i solved that problem if it is um entered there means that my submissions is successfully entered into database or not but from my side I can if I want to access that link directly then I can able to put the code and submit it successfully and it show me that it's solved but I don't know that if it is actually submitted there or not. For that I need to check uh i'll i'll tell you in the next class okay don't worry yeah sure sure thanks thanks thank you uh nara and vitova hello sir i'm all right yeah you want to call sir my question is related to in your selection where you check that

operation is equal to print and immediate after that there is if condition if q and then print okay pop left so here we don't check whether that queue is empty or not does it mean that python automatically you relate that whether that queue has value or not where is like the this one no could please scroll little bit up in the wherein yeah print print statement operation is equal to print so here i'm checking right yeah no no no no so i am checking the queue here okay i'm printing whatever i'm lifting out then if it is not true okay then else in the else i'm printing that hope you are getting so we don't need explicitly add check there q length is greater than zero right uh no it will automatically check in the q only q has value or not creating yeah you're correct when you are creating this now it will automatically check like some something uh different predefined in background it happens that whether it has value or not correct

great time um yes sir am i audible yeah yes sir actually left first assignment due date was on 22 august and i have submitted it on 23 august so if it it will affect my marks or it will be particle no it will not affect your mark okay sir thank you all right thank you yeah for confirmation i'm just asking you because because of i have a little bit doubt regarding the syllabus so the syllabus is showing the 24 syllabus but the same syllabus is applicable for 26 or not that i don't know man like your again you need to check with yeah you need to check 24 syllabus total सब्जिक के लिए 24 का यह syllabus लागा है but 26 के लिए applicable है out a syllabus regarding to aap cep ko pooch sakta hai yes sir cep ko pooch sakta hai ap okay by the way guys if you want to connect professionally then you can like although like a thank you for the so many connections over the linkedin okay and i didn't say it like the linkedin profile explicitly but

i'm saying it okay if you want to connect you can connect This is my LinkedIn ID, yeah. Soumya Singh. Yes, sir. Good afternoon, sir. Sir, I want to ask whether this test labs are, where is the link of this test lab one and test lab two? Okay, my apology, I didn't send the Excel sheet yet that I told the last class I will send it. But I'll prepare today, okay, the Excel sheet and we'll share in the I'll share in the today's class like a somebody to you that I know or like a I'll ping so like it will be there it will be showing right where it is in the quiz or in the assignment in that section only it will be there right yeah yeah yeah correct sir whether it contains the marks like whether it will be included in our semester marks these test labs it will be included yes sir okay thank you sir thank you and sir one more question is there one more question is there sir yeah yeah sir in the exam semester exams only MCQ type questions will be

there right yeah I already told you like a MCQ MSQ and following the true false like that like theory it will not be there right no okay thank you next krishna puma sukla hi hi aditya good morning so actually i have submitted day by day as assignment first second third so can you check it was submitted or not how can i aware my assignment was submitted i'll check this that's not your headache also i'll check and i'll let you know like it's not like that i'm not checking okay i'm checking i already sold you uh sorry i already i want so uk uh where i'm checking how much getting marks okay uh so yeah that will be already added in your like a last uh last semester okay i am only this that that is the aditya account which that was created that is the fine or not because uh can you check only this key because i submitted uh day by day suppose today i if you are submitting krishna then it is a considering only and it is submitting only and i can able to see that and if you're submitting after the deadline

then it will not show you even like it's open or like you cannot able to submit after the deadline so if you're submitting then i can able to see that yeah but created it was that is as you say now that the first name and your role number krishna and underscore pa2603 and it profile is showing at your missing detail zero percent so that context uh is that is fine or i have to get the more information about regarding these profile information and these things no no that's fine so uh that is the fine just my task is only to submit the day by day assignment and uh it was submitted to you oh sorry it was it was a trigger trigger to you yeah yes okay thank you aditya thanks krishna sir yeah who is this oh i didn't mute your mic okay i'm sorry okay you have any one minute i have to ask something uh just a second i want to say like i'll catch you after like something okay thank you um sunil kumar i think he's not hello hello no no i'm there i'm there i'm there sorry

so uh so my question is regarding um this assignment where there is uh there is um a line mentioned that you have to use std id only uh okay for input and output so is it Is it mandatory that you have to use the same sys function, I mean, sys library? I mean, like using std, in, in, and std output only? You're submitting in C++? No, in Python. Why std is required? Yeah, that's what, I mean, I don't know. It's coming here. That's why he asked, because when I'm selecting Python also, it's mentioning that read.

