Introduction to Queue Data Structure | C++ Placement Course | Lecture 24.1
HTML-код
- Опубликовано: 2 авг 2024
- Complete C++ Placement Course (Data Structures+Algorithm) : • C++ Full Course | C++...
Telegram: t.me/apnikakshaofficial
Instagram: / dhattarwalaman
Notes of this Lecture:drive.google.com/file/d/1LvRC...
thank god didi continued from here
I appreciate, ...really helpful.
This is really amazing! wow........................
very nice and precise explaination ,,, thank you so much didi...
here's the code :)
#include
using namespace std;
#define n 20
class queue{
int * arr;int back;
int front;
public:
queue(){
arr=new int[n];
front=-1;
back=-1;
}
void Enqueue(int x){
if (back==n-1){
cout
ooo re bhaiii thankss
This is very helpful video❤️❤️❤️
Didi is so busy in shifting from apni kaksha to apna college that in the intro she said "welcome to apni kaksha" instead of apna college.
Apart from that you are a great teacher
What's not great about saying apni kaksha
In pop operation first we have to reset the values of front and rear to -1.After that we have to increment the front otherwise the code will not work perfectly. See this
int pop()
{
int data;
//check empty or not
if (empty()) {cout
Thank you sister. Your lecture helped me.
Are yaar aache se samaj aaya hame 😌 apka dhanyavaad ☺
Thanks a lot. You made programming easier for me
This code is wrong at soo many levels, the most prominent one being, like here we have fixed length queue of 20, now in main function try to enqueue 15 times, dequeue 10 times, and then again try to enqueue 10 times, then you will understand that even when the queue seems empty it will output queue is full.
Basically the dequeue functions is wrong, it should be as following -
void dequeue(){
if (front==-1 || front>back) {
cout
11:41 My man got popcorns even before getting the tickets for the movie XD
Thanku so much for this ♥️
Thank you so much di
I need this video
9:31
//Ninja Technique to write empty() function...
bool empty()
{
return front == -1 || front > back;
}
Best content
nice explanation 👍
Great way of conveying. One recomendation is that if you replace mic for recording audio then it would be much better because there is a lot of distortion in your mic
Yes
literally ..it's very disturbing..
me soch ra mera earphone kharab hai🥲
Speed of Light ⚡⚡
Impressive 🥀❤️❤️💯
Goddamn this is good. I was skeptical at first about a free yt video but it fares much better than a lot of paid ones. Only issue was the mic was a bit loud at times and the case of checking if the queue is empty could be elaborated but otherwise it does a really good job of getting across what is necessary.
Is it better to use return statement in if rather than if else?if y or n how
Thanks didid
Ma'am don't know how to thank you ,but Ma'am Really Thank You, literally
Aaj tak jo cheeg samajh nahi paaya tha wo bhi aapke samjhane se samajh gaya,Dhanyawad Maam
Aap Aise hi padhati raho,hum padhte rahe aur jaldi jaldi cheezo ko seekh ke aage badhte rahe Ma"am
A random girl named Neha after listening her name again and again on this course be like:
"Maine kya bigaada tha aapka"
Mam mic issue is super annoying.
Please take care of that next time.
Else video is very nice.
Didi said '' welcome to apni kaksha"..... Anybody noticed?
🙂
😁
Matalab ye another channnel
Yes I think she if from another world 😂
Once I too searched apni kaksha instead of apna college 😂
0:01 apni *kaksha* 😑
How can they miss that
What if we set initial starting conditions as
front =0;
back =-1;
then we don't need separate if condition for the beginning
❤️❤️❤️❤️what a voice
0:01
Didi apni kaksha nahi, apna college! 🤨🧐
Apni Kaksha ....
But bhaiya big big big thanks to you. You are above all ❤️
Thank you aman bhai🙏✌
video is amazing like every video
your voice is also amazing .
but what happened with mic its super annoying ear burned
Mujhe laga naye headphones ka kharcha aa gaya😂😂😂
@@Adityasharma-oe8zp 😂😂lol
mujhe laga mere hi kharab hai xd
If we are just using front++ for pop function , then suppose capacity = 3 , we pushed 3 elements 3 , 7 and 8 . so front = 0 and back = 2 . Now , if we are popping them out front will become 3 by the time queue gets empty. SO if we will try to push something back is actually equal to n-1 i.e 2 so queue is full while it should be empty , so it prints Queue Overflow while queue is empty.
Thank You For The Session....
The same question in my brain 🧠
Means when we full queue and make it empty by pop method, then we cant push element in it?
@@chinmaypimpalgaonkar6949 Yes , according to the method shared by Sir in this video . Actually Sir has made a mistake that instead of just changing the value of front he should shift entire elements left by 1 , check it out on GeeksForGeeks for better understanding
@@ravikjha07 yeah
Yes you are saying correct but to handle this situation we have another concept which is called circular queue....
Here in this video they are explaining the basics/beginners queue concept to make beginners understand what queue actually is...
World no.1. Channel for student ❤❤
Aapke discription me jo playlist ki link di hui he usme kuch mistake he
Not found bta rha he us pr click krne pr
How many more vedios to complete this course??
Ma'am u r tooo gud... Tq .... 🙌🙌🥰🥰mata rani kre ap Bss aise hi pdate rho.
why we are using return -1? exactly what it will do ?
Coz data type of function is int so we have to return some value so in this case we are returning -1
Amazing content
Keep going :)
Why are you using stack's operations in queue code?
these are not inbuilt fucntions you can make any name if its your own defined.
👍👍
Mostly yar word hi use hwa is video ma but very informative video 💕💕💕💕
Mam front-- nhi ho ga jab pop krna ha @ Apna College
Thank you didi
why did we use 'new' keyword to define the array ?
why int *arr ?
🔥🔥🔥🔥🔥🔥🔥
Apni kaksha pr
I saw this video before 3 hours of my exam
#include
using namespace std;
struct Queue{
int *arr;
int size;
int r,f;
Queue(int n){
size=n;
f=0;
r=0;
arr=new int;
}
void capacity(){
cout
Wrote the exact same code but C++ still needs a type specifier for all declarations
Not apni kaksha
Welcome to apna college
background music is very attractive........
i guess video apni kaksha ke leye bana rahe the
0:01/11:41 apni kaksha
Why cant we use #include instead of creating a seperate class queue
We can, but In interviews you might asked to create a Queue and do some operations.
@@shivanshpratap3624 ahh makes sense.... thanks
nice
Ye yar yar वाली बीमारी तेजी से बढ़ रही है 😅😂😅😂
mam isme jab hum pop operation karte hai to array me values rehe jaati haina? or har pop operation ke baad array ka size chotta hota jata haina? kyuki apne 20 space ka banaya array, har pop operation ke baad wo ek box aage badhta hai.
We cannot remove poped or dequeued values as we are dealing with an array. We cannot deallocate index 1 while having data in succeeding indices ie.., 2,3,4... If we want to do that we have to copy the whole data from deallocated index up to the end and reallocate it from the deallocated index, where we have to deal with time complexity. Another approach is we can simply replace the data where we want to deallocate, with 0 or another value but all of them are integers so we can't differentiate whether we deallocated it or its originally having 0 or whatever value we use to replace. Another way is we can use the Integer type(in java) which accepts null. So to avoid all these things we usually use a linked list, we can allocate dynamically as well as we can deallocate data in the linked list.
@@vishnusudarsanam5375 thank u sir.
welcome to apni kaksha hahhahhah
she said front and back are pointers..to un k aage * lagana padega na?? ........
Aur while doing pop operation front++ kri hai sirf to wo piche element ne jo memory consume kiya tha wo apne aap khali hogayega kya??
if anyone knows about this please help
Wo pointer yaha pe literally pointer nahi batata hai.... wo yaha pe index ko bata rahi hai didi.... aur pop karte wakt front++ jab karte ho.... tab piche ke memory wahi pe rehte hai...... array mei kya hai kya nahi hai hume matlab nahi....
Hume matlab hai ki front aur back ke bich mei kya hai.... agar follow kiya hoga apne ...
arr[front] likhte hai... front aur back yaha normal integers hai... joki hum index ki tarah use kar rahe hai... to access elements from the array....
Hulle hullare hulle hulle hulle😎😎😎
Mic prblm ?
why have we created int*arr and not just a int arr[ ]???
To create dynamic array
I think the push operation needs to be changed. please see the below scenario
operation 1.) I declared an array of size 5. I pushed 5 elements to it(array is full). then front= 0 and back= 4.
operation 2.) I popped one element from the array. then front = 1 and back= 4. (which means the there is one available space in the queue because we popped the element).
operation 3.) Now again I am pushing an element but as the back= 4 [size-1], the if statement runs and, the program considers the queue is full even though there is one available space.
Isn't this a bug in the program. I mean even when there is space in the queue, it is still considering the queue is full.
I request someone who is familiar with this to please reply. Thank you.
I love you aman bhai
I am getting error ""queue" is ambiguous"
yaar konsa keyword hai ?? please explain in 5 marks.
Thank you dii ek doubt class k liye Bhi RUclips Mai live class rkh lo plzz,🙏🙏🙏🙏🙏🙏
new is keyword???
if yes then when we use this key word (at:-5:40 timing in video)
please reply me.
it is used same as we use malloc and calloc in C...
Selenium ke bhi video dalo
#include
#include
int main() {
queue q;
q.push(6);
q.push(7);
}
*yeh bhi show kerdete*
I just want to ask that , the circular queue priority queue and queue/stack implementation by linked list .are these concepts not important according to placement point of view because you haven't covered these concepts in your videos
suppose arr is full, now if we pop( ) one element the arr will remain full, we cannot again add element
In pop( ) function, we need to swap every element to its preceding element.
void dequeue()
{
if (empty() || front>rear)
{
cout
you see even if you that there is no meaning because that is one disadvantage of queue that is waste of memory which you are reffering to because we cannot add elements behind front pointer.
#include
using namespace std;
class que{
int st,en,*a,n;
public:
que()
{
st=-1;
en=-1;
cout
Thank you
Please provide the source code as well at the end of these videos 🙏🏻
#include
#include
using namespace std;
class queue{
public:
int* arr;
int size;
int front;
int back;
queue(int n){
size=n;
arr = new int[size];
front=-1;
back=-1;
}
void inqueue(int val){
if( back==size-1){
cout
voice is not clear
cracking sounds
Upload Tree and graph fast
Apni kakhsa was their previous name
0:01 apna college
queue ky andar inqueue and dequeue use krty hain
bro we can use any name , here push mean inqueue and pop means dequeue
Why to initialise front with -1 ? Initialise it with 0 instead and it will be much easier to handle everywhere.
how will u pop the arr[0] th element then
did anyone else notice she said apni kaksha rather than apna colg
are you watching this video for this purpose ??
🔥🔥on fireee
Bhot time se kuch upload nahi hua hai
Is anyone getting ambiguous problem when we are declaring the object of the class on the main function....how can I solve this :-/
u would be getting because of bits/c++ header file or queue header file
just remove those header files that error will be gone
@@palashagrawal2343 ok thnx bro.
@@palashagrawal2343 in program n is not declare in the scope
error....
Didi apne enqueue or dequeue ka use hi nhi kya?????
push=inqueue and pop=dequeue
yeah NEHA aur RAHUL ko tum logoun nay acha pakra hai😂
Anybody getting ambiguous error??
sir apni kaksha ko bhul gayo ho kya??
Mic problem 🙂
Please invest some money in buying a proper mic also. Audio quality is very low and distorted too.
movie dakhyna ka leay phaly neha cheya
Bhaiya please upload maths and chemistry lectures
kaksha ?
delete to baki hai mam