1. Copy Queue List folder
1
2
3
4
5
6
7
# include <QueueArray.h>
QueueArray <int> queue_name; //data type = int
queue.push()
queue.pop() //add item to the queue
queue.peek() //take item from the front of the queuebut do not remove it
bool isEmpty() // check if the queue is empty
int count //nbr of items in queue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if queue.count == 4{
val_in = ....
queue.push(val_in);
queue.pop();
initi = queue.peek()
delta = val_in - init
}
elif queue.count < 4{
queue.push(val_in)
}
else{
//reset array queueto empty
while queue.count != 0{
queue.pop()
}