//assume everything is in the queue. everything_in_queue = true; if(n > k){ //in this case, we can't have everything in the queue, so everything_in_queue = false; } else{ //now we have to actually check each thing. for j from 0 to n-1{ //only do the following until we find something outside the queue. if( everything_in_queue ){ in_queue = false; for i from 1 to k{ if(j == buffer_queue[i]){ //we found j in queue slot i. in_queue = true; } } //now update our understanding of whether the queue is full based on our knowledge of j. everything_in_queue = everything_in_queue & in_queue; } } }