finished queue
This commit is contained in:
parent
749926ba21
commit
38d527438e
@ -21,16 +21,26 @@ const int maxqueue = 100;
|
||||
|
||||
/*
|
||||
puts an element at the end of the queue
|
||||
|
||||
is "really" inserting at end of array
|
||||
*/
|
||||
void enqueue(int queueArr[], int elem, int &count){
|
||||
|
||||
queueArr[count] = elem;
|
||||
count = count + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
removes an element from the front of the queue
|
||||
*/
|
||||
void dequeue(int queueArr[], int &count){
|
||||
|
||||
is "really" deletion at index 0
|
||||
*/
|
||||
int dequeue(int queueArr[], int &count){
|
||||
int temp = queueArr[0];
|
||||
for(int i=0; i < count; i++){
|
||||
queueArr[i] = queueArr[i+1];
|
||||
}
|
||||
count = count - 1;
|
||||
return temp;
|
||||
}
|
||||
|
||||
void printQueue(int lst[], int count){
|
||||
|
Loading…
Reference in New Issue
Block a user