Queue Data Structure in C++ Programming (using arrays) | All Queue Operations | Part - 2

  Рет қаралды 149,626

Simple Snippets

Simple Snippets

Күн бұрын

Пікірлер: 199
@shubhambaranwal31
@shubhambaranwal31 4 жыл бұрын
int count() { if(rear==-1 && front==-1) return 0; else return rear-front+1; } count should be like this otherwise without element also count will be 1. Well thank you sir
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Yes this seems correct. I will pin your comment Shubham, thank you for pointing this out ✌
@dibbyabarua9499
@dibbyabarua9499 4 жыл бұрын
I checked if(isEmpty()) :3
@joseph2073
@joseph2073 3 жыл бұрын
else is not required actually ... ~~ if (rear==-1 && front==-1) return 0; return rear-front+1; This one ...
@UJJWALKUMAR-dg9mw
@UJJWALKUMAR-dg9mw 3 жыл бұрын
@Jermaine Randall u both r everywhere so i m reporting u
@altamish_turk
@altamish_turk 2 жыл бұрын
I also came here in the comments box to tell this issue
@SimpleSnippets
@SimpleSnippets 5 жыл бұрын
Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more content just for you ✌
@usamafiaz6964
@usamafiaz6964 3 жыл бұрын
Love You Bruh. I'm in 3rd semester and studying Data Structures. Its Going Outstanding.
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thats really great to know buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@minahilxbts5925
@minahilxbts5925 3 жыл бұрын
foundation uni?
@KingKhan-lt4mn
@KingKhan-lt4mn 3 жыл бұрын
@@minahilxbts5925 may be fast uni faisalabad campus
@abdulwahabkhan5260
@abdulwahabkhan5260 2 жыл бұрын
@@KingKhan-lt4mn not fast because we have 6 digits after the branch character, just like mine
@omkarhiwant5157
@omkarhiwant5157 10 ай бұрын
Same to you
@AnoopKumar-bk2us
@AnoopKumar-bk2us 5 жыл бұрын
Today my search ends here about QUEUE... best explanation... !!! thanks !!!
@SimpleSnippets
@SimpleSnippets 5 жыл бұрын
Thanks bro 😬 I'm glad you liked it ✌️ also please do share it with your friends bro 😊
@A9Shows
@A9Shows 5 жыл бұрын
Man; this is the best explanation I have ever heard in a KZbin video
@SimpleSnippets
@SimpleSnippets 5 жыл бұрын
Hehe thanks bro🤟 please do share the video with your friends too 😊
@A9Shows
@A9Shows 5 жыл бұрын
@@SimpleSnippets sure
@deveshparmar9186
@deveshparmar9186 3 жыл бұрын
BEST DSA course ever on youtube love the way you teach!
@samChakravartiSamrat
@samChakravartiSamrat 4 жыл бұрын
bhai, apke is channel ko to 1Milllion subcribers hona chaiye, itne acche aur satik tareeke se koi DS padha v skta h, vishwas nhi ho rha h!!!!!!!!...m apka bhot bhot abhari hu, jo apne itne jatil vishayon ko v itne saral aur graphics se zariye itna accha banaya ki hm ubte tk nhi!!!!!please ap CS k baaki subjects ko v graphics k zariye padhaeyega (but free m, bhai :)), taki humara bhala ho....apko ishwar sada sukhi rakhe...... -Apka ek subscriber....
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you Samarth, aapka ye comment padhke bohot acha laga and motivation mila aur aise educational videos bananke liye. And ha aur bohot saare educational videos ye channel par upload hoti rahegi bilkul FREE. Please aap ye channel and videos aapke dosto main share karey. Yehi bada support rahega 🙏
@AjayKumar-ju6sl
@AjayKumar-ju6sl 4 жыл бұрын
At 14:07 it gives count 1 even if the queue is empty That's why first we have to check for isEmpty and return 0 if isEmpty is true.
@vijaysinghchauhan7079
@vijaysinghchauhan7079 4 жыл бұрын
Rigorous explanation. I am satisfied. Thank you, Tanmay Sakpal.
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
So nice of you
@albertd.bangura3794
@albertd.bangura3794 3 жыл бұрын
You are the best when I think of clear and excellent explanation on KZbin! Thank you for making these videos, and I will always support you by sharing your channel with my friends and mentees!
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thank you so much Albert. Because of you and such amazing support from you I get motivated to make more such free & high quality educational for all of you👍❤️
@albertd.bangura3794
@albertd.bangura3794 3 жыл бұрын
@@SimpleSnippets 💖
@servantofthelord8147
@servantofthelord8147 2 жыл бұрын
Your series has been a blessing to me and my life. May God bless you.
@mananjagani2892
@mananjagani2892 4 жыл бұрын
Your explanation is mind blowing. Through your videos i get to learn things in a single shot! I have one request - can you please make a video on linked list implementation of stacks and queues.
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Hello Manan, thank you so much for such a positive feedback. I am glad to hear that these videos are easy to understand for you. Please do share these videos and our channel with your friends too. Thats the biggest help and support. And talking about your request, yes I will cover this topic soon so hope you have subscribed and turned on the notifications ✌
@ketanahuja8939
@ketanahuja8939 4 жыл бұрын
@@SimpleSnippets please make as soon as possible on stack implement using linklist
@vissamsettykalyan5695
@vissamsettykalyan5695 3 жыл бұрын
if(rear==-1 && front==-1) return 0; else return rear-front+1; for printing elements we can use this rather than printing those deleted 0's :) Thank You sir!
@atharvakurumbhatte3413
@atharvakurumbhatte3413 3 жыл бұрын
Hand down! This is one of the best explanation on DS
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thanks bro 🤘
@ankitapareek489
@ankitapareek489 3 жыл бұрын
Awesome!!! DS and algo was never so easy for me.....I was always scared of these....But the way you explain things makes them seem so easy and fun!! Thank you so much dude for the great work! :) I've also recommended this channel to many people...And then they even thanked me for the recommendation and told how your channel saved them! xD xD xD
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
I'm so glad! Thanks Ankita, means a lot 😇🙏
@shapind
@shapind 4 жыл бұрын
Simply a perfect channel for perfect programming!!! 👊 thanks alot brother❤️
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Glad you enjoy it! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@shapind
@shapind 4 жыл бұрын
@@SimpleSnippets sure brother! 👊
@Aishwarya__1814
@Aishwarya__1814 Жыл бұрын
My always go to channel for my degree is justtt simple snippets alwaysss..... Thank you brother💁🏻‍♀️
@subhashisbhowmik7
@subhashisbhowmik7 3 жыл бұрын
keep it more simple @simple snippets #include using namespace std; int rear,front; int arr[5];int value; class queue { int front,rear; public: queue() { front=-1, rear=-1; for(int i=0;i
@xxxbosetoxxx9908
@xxxbosetoxxx9908 3 жыл бұрын
Thanks for the display function
@arpitnamdev7031
@arpitnamdev7031 2 жыл бұрын
Queue Concept and its operations are now clear,thanks Tanmay Bhai 😍👍👍🙌🙌
@sharvarijahagirdar9160
@sharvarijahagirdar9160 4 жыл бұрын
Your channel is like finding an oasis in Sahara Desert..... Thanks for the great explanation and endless effort !!!
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Hehehe thank you so much Sharvari 🙏 this was a great comment 😬 please do share this channel so that others also find this oasis 😉😊 Hope you are staying home & safe. Tc ✌️
@sharvarijahagirdar9160
@sharvarijahagirdar9160 4 жыл бұрын
@@SimpleSnippets I hope you too are safe and sound at home. 😇
@UEC_AbhayKumar
@UEC_AbhayKumar 3 жыл бұрын
Your contents are amazing💖. I'm thankful to you from my heart❤❤
@sheemasumair7423
@sheemasumair7423 Жыл бұрын
Way of teaching ufffff kirrakkk hai
@Ozelea
@Ozelea 2 жыл бұрын
I think this is better approach to display the queue void display(){ if(isEmpty()){ cout
@sandeepnayak6357
@sandeepnayak6357 4 жыл бұрын
Bro your way of speaking and fluency in English is wonderful...👍👌👏👏
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you so much Sandeep. This is such a great compliment. Hope the video was good and easy to understand as well ?
@sandeepnayak6357
@sandeepnayak6357 4 жыл бұрын
@@SimpleSnippets the video was wonderful bro...keep making such videos help us...👍👍👌...
@be_calm2372
@be_calm2372 3 жыл бұрын
Following you since 20k subscribers you had ❤️
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Wow that's amazing to know buddy ✌️ grateful for your support always 👍
@hareshparab7808
@hareshparab7808 2 жыл бұрын
bro u are op wish u were getted me at the time of diploma till now i was be at the intermediate level of programmer
@NimishRamteke
@NimishRamteke 3 жыл бұрын
to understand dequeue operation better use this : void dequeue(){ if(isEmpty()){ cout
@tqaquotes9379
@tqaquotes9379 3 жыл бұрын
22:10 Drawback of "queue"
@muhammaduzmankhan2303
@muhammaduzmankhan2303 3 жыл бұрын
Best DSA explanation man
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Glad you think so!
@yashwardhanchavan6153
@yashwardhanchavan6153 4 жыл бұрын
Awesome!!!! Understood everything.. Thanks.
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thanks amazing Yashwardhan. Glad to hear this. I hope you have subscribed to this channel & please share this video with your friends too. That will be the biggest help & support 😇
@asaadhabibkhan8420
@asaadhabibkhan8420 3 жыл бұрын
You are saving my 3rd semester. 🙈 🙈 Thanks a lot. 👍 Please make some videos on graphs also.... I guess I didn't find them in Data Structure's play list....
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Will upload soon
@aqeeltariq4885
@aqeeltariq4885 3 жыл бұрын
bro you are the best
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thank you so much buddy
@SGAbid
@SGAbid 2 жыл бұрын
Here is the change() function, if anyone is wondering how to implement it. I have tried to make it dynamic, but we can make our own adjustments. Code: void change() { int x = front; int y = rear; int z; if(isEmpty()) { cout
@kuntalgupta7439
@kuntalgupta7439 5 жыл бұрын
even if the queue is empty, the COUNT shows 1. Please correct that exception. . . Good work man!
@SimpleSnippets
@SimpleSnippets 5 жыл бұрын
Thank you so much 😇
@akashkhairal
@akashkhairal 5 жыл бұрын
Edit the code like this: int count() { if(front == -1 && rear == -1) return (rear-front); else return (rear-front+1); } Then your problem will be solved.
@shubhgupta2539
@shubhgupta2539 4 жыл бұрын
Best explanation but in the count function it is (rear - front +1 ) but if both the rear and count are at -1 and -1 the count should be zero but it is 1..
@dhonddevameya2362
@dhonddevameya2362 4 жыл бұрын
Well in that case we should add if else statement in count function to show the isempty condition(rear=front=-1).Then your problem will be solved.
@sulabdhungana3327
@sulabdhungana3327 4 жыл бұрын
Great Explanation!! Minor bug fixes: bool isFull() { if (r-f == size-1) { return true; } else { return false; } } int count() { if (r == -1 && f == -1) { return 0; } else { return (r - f) + 1; } }
@laxmigupta698
@laxmigupta698 4 жыл бұрын
Wow...now I know what is queue... 😌 Thankyou sir...🙏🙏🙏
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
That's great to know buddy 😁 please subscribe & share this channel with your friends yaa😊✌️
@konstantinossimatos3466
@konstantinossimatos3466 27 күн бұрын
When we create methods it is in the responsibility of the user (programmer) to make good use of those methods. For example, since you implemented the isEmpty() and isFull() methods, it is better to use them (in main method) before calling the enqueue and dequeue and not use them inside methods. example in class ///////////////////////////////////////////////////////////// void enqueue(int val) { if(front == -1) ++front; arr[++rear] = val; } ///////////////////////////////////////////////////////////// int dequeue() { int val = arr[front]; arr[front] = 0; if(front == rear) front = rear = -1; else ++front; return val; } ////////////////////////////////////////////////////////////// in main() case 1: cout > value; if(!q.isFull()) q.enqueue(value); else cout
@harshpratapsingh1638
@harshpratapsingh1638 3 жыл бұрын
If you will take question it will be better 🙂
@AnkitKumar-xz4uh
@AnkitKumar-xz4uh 3 жыл бұрын
when we enter count in empty queue then count value should be 0 but in this code count value is showing 1
@christianclark1309
@christianclark1309 3 жыл бұрын
You can call isEmpty and return 0 if it is true to fix this
@AnkitKumar-xz4uh
@AnkitKumar-xz4uh 3 жыл бұрын
@@christianclark1309 thanks dude
@Nader95
@Nader95 3 жыл бұрын
for the problem at the end when you remove items from the front of list, why can't you shift every item left one space so that your new front item will be at index 0; then the rear would be decremented by 1. Therefore, your rear==4 will return false because now is rear==3
@siobhanmarshall4048
@siobhanmarshall4048 Жыл бұрын
I was thinking the same thing but then how would the code look like? Could we use a for loop?
@dhonddevameya2362
@dhonddevameya2362 4 жыл бұрын
When we carry dequeue operation, should the elements shieft by one index towards the element which was dequeued? Like we have five elements 10 20 30 40 50. And we carried dequeue Then 10 gets dequeued And the new sequence should be 20 30 40 50 0 Right?
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
You can make that happen according to your needs. Generally its not how a very basic queue operates ✌
@dhonddevameya2362
@dhonddevameya2362 4 жыл бұрын
@@SimpleSnippets ok.Thanks
@akhileshdhindsa8830
@akhileshdhindsa8830 4 жыл бұрын
Nice code but if someone insert 0 in the queue and display it then the output will be just zeros and it may become confusing at that index whether element is inserted or is it empty position. While displaying 0 should be converted to null.
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
You can add that functionality with some extra code ✌
@SudhanshuSingh-ew2fi
@SudhanshuSingh-ew2fi 4 жыл бұрын
Why we cannot have peek operation in queue data structure?
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
We can. Its just that it is not considered as a standard queue operation. In some cases it is. So its really on you how you implement ✌
@gauravbhasme1461
@gauravbhasme1461 3 жыл бұрын
sir you told about 1 drawback of a simple queue is that isFull() couldn't give the correct and when some elements were dequeued but I coded it like this which gives true only when a queue is full otherwise not bool is_Full(){ if(last-head==4) return true; else return false; } please inform if it is wrong
@gauravbhasme1461
@gauravbhasme1461 3 жыл бұрын
but you are teaching in an awesome way I love it and now I'm addicted to learning from only you
@classim3715
@classim3715 4 жыл бұрын
If you add 3 element in the quee and then dénuée the first element you will have something like 0 56 34 0 0 and if you call the count function it will execute rear-front +1 which is =-1-(-1)+1=1 ;which is wrong because you still have 2 element not one so to fix this you can initialize int itemsnumber. to 0 and do for (int i=0;I
@classim3715
@classim3715 4 жыл бұрын
My English is great but I hope you understand what i meant
@daverussell4052
@daverussell4052 3 жыл бұрын
i decide to shift all element to left after i dequeue.. and i think using front and rear more effective if the element are dynamic like linked list
@MithleshKumar-pr7ew
@MithleshKumar-pr7ew 3 жыл бұрын
Very very thankful sir
@pragya_mishra29
@pragya_mishra29 2 жыл бұрын
Thankyou so much....explained it so well.
@gopeshsinghal3692
@gopeshsinghal3692 4 жыл бұрын
There is mistake in count function also...if we does not enqueue any value....count must be 0 but this will show 1 because in that case rear and front both are -1 and -1-1+1 is 1.....so put this case also in count function when front and rear are -1
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Yes agreed! This was a silly mistake from my side ✌
@nikunjsethi9351
@nikunjsethi9351 2 жыл бұрын
We can just use return (rear+1); for count
@melusimoyo3249
@melusimoyo3249 2 жыл бұрын
That will only work correctly if you have not dequeued anything. Once you dequeue an the front idex moves from zero, (rear + 1) will give you a count that is more that what is in the queue
@joseph2073
@joseph2073 3 жыл бұрын
bool isFull() { if(rear==4 && front==0) return true; else return false; } If statement should be like that coz, after fully filling the array and doing dequeue... The front increases but not rear ... & Thus it's not actually full, still it shows FULL .. coz front = 1 and rear = 4 ... So in if statement, both conditions should be checked !!
@dibbyabarua9499
@dibbyabarua9499 4 жыл бұрын
So, I had a quick question. When is a queue full? I understood all the concepts and your video was AWESOME (as always haha)... but not being able to define if the queue was full or not made me think what a queue being full meant? I'd appreciate if you could let me know. Thanks and like you always say... Peace
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
I didnt really get your question here. A queue is full when all the values in it are occupied. A simple queue also has one drawback when a queue is dequeued the front pointer moves one position ahead essentially reducing the size of the queue by 1 because the front of the queue has to be removed off so we do it by dereferencing(meaning the front pointer no longer points to it). This creates an issue where some space from the start gets wasted after every dequeue. Hence we have circular queue as well to tackle this issue. Check the circular queue video I think you will understand much better what I am trying to explain here ✌
@dibbyabarua9499
@dibbyabarua9499 4 жыл бұрын
​@@SimpleSnippets so my question is why we cannot define the is_full() func like this for a linear queue? isFull() { if(f==0 and r == (size(arr)-1)) return true; else return false; } in the isFull() function?
@MasterPanda10998
@MasterPanda10998 3 жыл бұрын
@@dibbyabarua9499 because we just can't add further entries because the last value is present so as to deal with this exception we checked the rear end as size-1. This can be solved with dequeue
@dibbyabarua9499
@dibbyabarua9499 3 жыл бұрын
@@MasterPanda10998 I did it instead using a dynamic array or linked list... Which can grow or shrink base on the operation done on it. Peace.
@vikasbisht891
@vikasbisht891 4 жыл бұрын
in dequeue why we have written return x, i mean we dont need that x right. could the return type of dequeue be void??
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Good question, when you simply want to remove it you can keep it void, but if you want to use it somewhere, returning might be helpful 😇
@khyatiyadav2873
@khyatiyadav2873 4 жыл бұрын
Can you please upload vedios on What is doubly ended Queue (Dqueue) and it's c++ implementation using linked list representation C++ implementation of Queue using circular linked list C++ implementation of Stack using linked list
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
I have done stack using linked list and queue using linked list I guess. check the full course!
@khyatiyadav2873
@khyatiyadav2873 4 жыл бұрын
Ok thankyou Then please make a vedio on Dqueue
@anishamundra601
@anishamundra601 4 жыл бұрын
Amazing explanation
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you Anisha, please do subscribe & share the videos with your friends. Thats the biggest support you can provide to the channel 😇
@NimishP
@NimishP Жыл бұрын
Shouldn’t we advance the entire queue by one position when dequeue() method is invoked? That will make room for one more element in the queue to be added.
@aizazalikhan7704
@aizazalikhan7704 4 жыл бұрын
When we dequeue all the elements how the rear and front go to -1 as there is no change in rear in the else part of the dequeue function. Whenever i dequeue all the elements i can not enter new elements in the queue so the queue becomes useless. Can you help me?
@RahulYadav-gd3tn
@RahulYadav-gd3tn 4 жыл бұрын
to overcome this limitation, circular queue comes into picture
@aroobamalik9067
@aroobamalik9067 4 ай бұрын
nope in display i should be less then rear else it will display zeros void display() { if (isempty()) { cout
@nitismita1035
@nitismita1035 2 жыл бұрын
Thank bro 🙏🙌love 💘
@nafisahmed3607
@nafisahmed3607 2 жыл бұрын
Amazing ❤️🇧🇩
@mahesh-jg3zx
@mahesh-jg3zx 4 жыл бұрын
Sir please 🙏🙏 🙏 do the video on queue abstract Data type
@rahmadinijihan1103
@rahmadinijihan1103 Жыл бұрын
thanks so much man
@mdsisakib5897
@mdsisakib5897 2 жыл бұрын
Count method has a bug. The first statement must be: if(isempty()) return 0;
@engineersanaullahvlogs
@engineersanaullahvlogs 3 жыл бұрын
best explanation sir you are the best i realy like it good sir keep it up you deserve the suscess insallah
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Many many thanks
@engineersanaullahvlogs
@engineersanaullahvlogs 3 жыл бұрын
@@SimpleSnippets Most welcome sir i really liked your vedios very helpful seriously from islamabad pakistan
@snehapatil4677
@snehapatil4677 3 жыл бұрын
Best explanation 💯💯
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Appreciate that! Please do share the videos and our channel with your friends if you want to genuinely support me & our channel!✌😇
@muhammadatif7602
@muhammadatif7602 4 жыл бұрын
You are awesome😇
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
That's great to know buddy, please do Subscribe to our channel as we have a lot tech educational content which you'll surely like. Also please do share our channel and videos with your friends too, that's the biggest help and support you can provide buddy ✌
@mdikbalhosen1711
@mdikbalhosen1711 3 жыл бұрын
your tutorial is awesome. It will be more effective if you give the source code.
@Zeeshanhaider-wo5bs
@Zeeshanhaider-wo5bs 8 ай бұрын
Sir you are initializing the array indices with 0..... What if we want to add 0 in the queue it might be confusing that index has some value or is it empty?
@ameerhamza1182
@ameerhamza1182 3 жыл бұрын
when we enqueue 5 items and then dequeue 1 item... it places 0 at that place...and then again if we enqueue 1 item it says queue is full ??? why???
@ahmedrizwan7155
@ahmedrizwan7155 4 жыл бұрын
I think you should check your dequeue "else" block it should be [x=arr[rear]; arr[rear]=0; rear--;] in order to established FIFO or LILO in your code it is currently performing FILO or LIFO(stack) Am I right or not bro??
@bingkysskiliwaax7941
@bingkysskiliwaax7941 4 жыл бұрын
You re wrong
@muhammaduzmankhan2303
@muhammaduzmankhan2303 3 жыл бұрын
Amazing
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thank you! Cheers!
@Mahesh-wr6uc
@Mahesh-wr6uc 4 жыл бұрын
Bro kindly can you please make a vedio on queue by dynamic data structures
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Sure thing but will take time :-)
@Mahesh-wr6uc
@Mahesh-wr6uc 4 жыл бұрын
@@SimpleSnippets ok bro
@mkarthikeyan6616
@mkarthikeyan6616 Жыл бұрын
I have just used rear variable for the implementation I run in for loop I just make arr[rear]=0 and than decrement the rear In dequeue operation....it is correct? Else we must use the two variable to implement the queue operation
@yogeshjangid270
@yogeshjangid270 3 жыл бұрын
thank you! :)
@kaushik7811
@kaushik7811 4 жыл бұрын
Is there an option to replace 0 with null because if someone enqueue 0 then it will be confusing right. When he uses display function then it will show the empty ones which is 0 and his 0. So how to solve that issue.
@arnelrevilla9539
@arnelrevilla9539 2 жыл бұрын
Why does my code says i use undeclared variable x? But your code runs smoothly
@ShaikSaleem786-gv9eq
@ShaikSaleem786-gv9eq 5 ай бұрын
One doubt bhaiya kya hum enqueue nahi karsakthaa values koo after performing dequeue operation kyku ki waha phar zero hai naa
@adarshtripathi3199
@adarshtripathi3199 3 жыл бұрын
in count function what if the queue is empty --> rear-front+1 would give wrong ans
@muhammadrafi3276
@muhammadrafi3276 2 жыл бұрын
why do we use return in enqueue function in if(isFull()) where as enqueue function type is void and does not return any type. please help me understand it.
@tejaskakad4229
@tejaskakad4229 4 жыл бұрын
What if you want to make a queue of size value entered by the user?
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
dyanmic memory allocation ✌
@kshitizkaintura2117
@kshitizkaintura2117 2 жыл бұрын
/* int dequeue(){ if (isempty()) { cout
@duxstybrick2536
@duxstybrick2536 4 жыл бұрын
I didn't see any particular use of variable front it just use to store 0?
@algorithmo134
@algorithmo134 3 жыл бұрын
You made a mistake for dequeue method at else if (front == rear). arr[front] should set to 0 after dequeuing. See * below. int dequeue(){ int x; if (isEmpty()){ cout
@moralstories4188
@moralstories4188 3 жыл бұрын
Sir can you please upload quiz for your covered topics. Thank you
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
As soon as possible
@pranavpatki
@pranavpatki 4 жыл бұрын
can you pls explain how to enter size of array dynamically instead of already keeping it as 5??
@dt8129
@dt8129 4 жыл бұрын
int s ; int arr[s]; and then you can take value of s ; cin>>>s ;
@joanjoshy1599
@joanjoshy1599 4 жыл бұрын
@@dt8129 where should we include this code? Under private or public section?
@tiptrcks3960
@tiptrcks3960 2 жыл бұрын
@@dt8129 better way is to use a pointer : int* ptr = new int[take input from user]
@hgtd2700
@hgtd2700 Жыл бұрын
i went to the site for this topic and in there is an error in the dequeue implementation
@nabeehazahid9613
@nabeehazahid9613 4 жыл бұрын
bu the display function, the address of the elements is also getting displayed after the elements . I am new to c++ plz help
@erehuchiha303
@erehuchiha303 4 жыл бұрын
What if we are having some of our array entries as zeroes.. it will just make confusion ? Any soln over it?
@shortsbytuffy_shero8430
@shortsbytuffy_shero8430 3 жыл бұрын
Sir ,the only thing I didn't get is when we assign all values of array 0 .them why queue is empty??
@elmo2683
@elmo2683 2 жыл бұрын
Yes Queue is filled with zeros but we have assigned front and rear as -1 therefore Queue is empty.
@elmo2683
@elmo2683 2 жыл бұрын
Bhai why dont you create change and delete method in the class. Is it means that these methods we cant use in the Queue data structure?🤔
@namithamadhusudan7613
@namithamadhusudan7613 3 жыл бұрын
int count(){ if(rear == -1 && front == -1){ return 0; } else{ return (rear-front+1); } } I wrote this as count function and it is not working! can someone help?
@fatimaiqra2169
@fatimaiqra2169 3 жыл бұрын
if we initialize arr[i]=Null; in constructor ,is it correct?
@be_calm2372
@be_calm2372 3 жыл бұрын
Thank you
@utkarshpawar8336
@utkarshpawar8336 3 жыл бұрын
bool isFull() { if (front == 0 && rear == 4) //* i.e. if(rear==sizeof(arr)-1) { return true; } else { return false; } }
@zoniamunir7691
@zoniamunir7691 Жыл бұрын
Dequeue operation perform nai ho rha es code .any other code?
@AnandMishra-rt2rs
@AnandMishra-rt2rs 7 ай бұрын
Sir can we use this code in turbo c++ ide ? Please answer
@homosapien7754
@homosapien7754 4 жыл бұрын
What happens if I define all the functions inside the main() and not under the class?
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Try it and you will know
@aakashupadhyay5271
@aakashupadhyay5271 3 жыл бұрын
Here anyone is from IIT ?
@abhimanyu6534
@abhimanyu6534 3 жыл бұрын
Bhaii plz btao ki agr hame dynamically user se size lena h to kaise krenge 🙏🙏🙏😓😭😭
Tinder Style Swipe Cards with React & Framer Motion
18:38
Tom Is Loading
Рет қаралды 134
Lehanga 🤣 #comedy #funny
00:31
Micky Makeover
Рет қаралды 29 МЛН
طردت النملة من المنزل😡 ماذا فعل؟🥲
00:25
Cool Tool SHORTS Arabic
Рет қаралды 10 МЛН
Can This Bubble Save My Life? 😱
00:55
Topper Guild
Рет қаралды 68 МЛН
Queue Data Structure In STL | C++ Tutorial
18:44
Portfolio Courses
Рет қаралды 12 М.
how Google writes gorgeous C++
7:40
Low Level Learning
Рет қаралды 853 М.
C++ arrays explained 🚗
5:29
Bro Code
Рет қаралды 13 М.
Lehanga 🤣 #comedy #funny
00:31
Micky Makeover
Рет қаралды 29 МЛН