Thanks greg, sounds good to me, basically the following code:
if (length == 0) then
{
front = 0 ;
back = 0 ;
}
else
{
back = back + 1 ;
if (back == limit) back = 0 ;
}
buffer[back] = value to add into the queue ;
length = length + 1 ;
Which from what i’ve worked out, if for example, the numbers 1, 2, 3 are at buffer 2 3 and position 4
If an element numbered 8 is added to the queue, then it would be added to position 5 of the buffer, 1, 2 and three would remain at position 2, 3 and 4.
If the element 1 is removed, all of the other numbers would remain in the same place.
So back to the first post question, i’m assuming it’s asking if i search for a value it will say what buffer position the number is, and if its been repeated in another queue position.
This is where i’m a little stuck, i’m guessing i will need to use a loop to go through each buffer position to find a value?