Skip to content

Commit 4bb56d1

Browse files
committed
fixed the bug TheAlgorithms#2690 in data_structures/queue_using_array2.cpp
1 parent 2dadbf7 commit 4bb56d1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

data_structures/queue_using_array2.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#include <iostream>
22
using namespace std;
33

4-
int queue[10];
4+
int arr[10];
55
int front = 0;
66
int rear = 0;
77

88
void Enque(int x) {
99
if (rear == 10) {
1010
cout << "\nOverflow";
1111
} else {
12-
queue[rear++] = x;
12+
arr[rear++] = x;
1313
}
1414
}
1515

@@ -19,9 +19,9 @@ void Deque() {
1919
}
2020

2121
else {
22-
cout << "\n" << queue[front++] << " deleted";
22+
cout << "\n" << arr[front++] << " deleted";
2323
for (int i = front; i < rear; i++) {
24-
queue[i - front] = queue[i];
24+
arr[i - front] = arr[i];
2525
}
2626
rear = rear - front;
2727
front = 0;
@@ -30,7 +30,7 @@ void Deque() {
3030

3131
void show() {
3232
for (int i = front; i < rear; i++) {
33-
cout << queue[i] << "\t";
33+
cout << arr[i] << "\t";
3434
}
3535
}
3636

0 commit comments

Comments
 (0)