+ 1

What is meant by delete in queue, because when we delete an element it doesn't delete it it stay in queue but we cant use?

When we delete a element in queue the element does not is getting erased so what is the meaning of it

16th Jan 2020, 12:20 PM
venkatrao bhnala
venkatrao bhnala - avatar
2 odpowiedzi
+ 4
venkat bhnala The process of removal of an element from the queue is called dequeue. After dequeue operation the values in the queue shifted left side. After removal it's not present in queue can you please describe about your code or better link it here as deletions will remove the elements.
16th Jan 2020, 12:25 PM
DishaAhuja
DishaAhuja - avatar
+ 1
venkat bhnala Yes. But it is not completely true. It depends on the how you are implementing.. But when dequeue operation applied the values in the queue shifted left side. So current dequeued element is replaced with next element if any there... And last 2 elements are same until only, it replaced by any element.. So that's why it exists (when you have only one value) (or last 2 elements are same) but you can't access.. The stack and queue... are some are the concepts to manage elements in some form. In real applications, when implementing queue, you have to completely remove dequeued element from the memory by freeing memory or deleting the entries.. So it's only because of logics you are implementing... Hope you got point..
16th Jan 2020, 4:15 PM
Jayakrishna 🇮🇳