Hello Guys, I'm new to this awesome helpful site. I've been watching alot of tutorial on Queue array implementation and read a lot of answer. But could not find a solution to my problem this is my Enqueue & Dequeue functions
Queue
frontIndex:0
backIndex:3
Size:3
Empty:false
Full:false
elements
array[0]:1
array[1]:2
array[2]:3
great. But the problem is whenever I degueue() output is:
Queue
frontIndex:1
backIndex:3
Size:3
Empty:false
Full:false
elements
array[0]:0
array[1]:2
array[2]:3
if Dequeue() two more times.
out put is
Queue
frontIndex:3
backIndex:3
Size:3
Empty:true
Full:false
elements
array[0]:0
array[1]:0
array[2]:0
instead of deleting the value. Degugue replacing the value with 0. so how do I actually delete the value.
You keep track of both front and back index so I assume you are trying to implement this as a circular buffer. In that case it should not be necessary to shift any elements when dequeuing.