I was thinking the same. He is technically not removing the element. However, the next time you enqueue, it will just overwrite the values because the tail is still referenced correctly. I guess that works, however if you print the queue that old value that was dequeued will still be there unless it's overwritten with a new value via the enqueue call.
If you want to physically remove the element, you can just set it to None. So after "data = self.storage[self.head]" just add "self.storage[self.head] = None"
hi if ur size is lower than ur capacity, how do u enqueue into an index that is out of range? ie. self.storage[self.tail] = data would return an error since self.tail exceeds the index range of the queue would u perhaps need to use append instead? but that would bring in O(n) space
Very nice way to explanation, and it is super easy to understand after watching this video. Thank you for this content 😊
Superb !! ....there are very few video which were implemented in python . Good move 😉. Looking forward for more 😍
Thank you bro, you resolved my 2 days of confusion :-)
thank you so much for this vid, I was so ready to pull half of my hair out, this made it super clear!!
Best explanation
amazing explanation thank you
Good job
in dequeue method of circular queue, you didn't use any pop function, how did u remove the elements?
I was thinking the same. He is technically not removing the element. However, the next time you enqueue, it will just overwrite the values because the tail is still referenced correctly. I guess that works, however if you print the queue that old value that was dequeued will still be there unless it's overwritten with a new value via the enqueue call.
If you want to physically remove the element, you can just set it to None. So after "data = self.storage[self.head]" just add "self.storage[self.head] = None"
thank you my lovely friend!!!!
brilliant
So this is a custom implementation of queue? if so, when would you use (or not) the official queue from python?
hi if ur size is lower than ur capacity, how do u enqueue into an index that is out of range?
ie.
self.storage[self.tail] = data
would return an error since self.tail exceeds the index range of the queue
would u perhaps need to use append instead? but that would bring in O(n) space
You can't append in a array based queue as the size is fixed
attach the code for ur super help full videos
perfect!