We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2dadbf7 commit 4bb56d1Copy full SHA for 4bb56d1
data_structures/queue_using_array2.cpp
@@ -1,15 +1,15 @@
1
#include <iostream>
2
using namespace std;
3
4
-int queue[10];
+int arr[10];
5
int front = 0;
6
int rear = 0;
7
8
void Enque(int x) {
9
if (rear == 10) {
10
cout << "\nOverflow";
11
} else {
12
- queue[rear++] = x;
+ arr[rear++] = x;
13
}
14
15
@@ -19,9 +19,9 @@ void Deque() {
19
20
21
else {
22
- cout << "\n" << queue[front++] << " deleted";
+ cout << "\n" << arr[front++] << " deleted";
23
for (int i = front; i < rear; i++) {
24
- queue[i - front] = queue[i];
+ arr[i - front] = arr[i];
25
26
rear = rear - front;
27
front = 0;
@@ -30,7 +30,7 @@ void Deque() {
30
31
void show() {
32
33
- cout << queue[i] << "\t";
+ cout << arr[i] << "\t";
34
35
36
0 commit comments