forked from rbk-org/Java_DataStructures
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueue.java
More file actions
30 lines (28 loc) · 682 Bytes
/
Copy pathQueue.java
File metadata and controls
30 lines (28 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
public class Queue {
// your code is here
int storage[]=new int [3];
int counter=0;
public void push(int pushedElement){
//your code is her
// e
if (counter>2){
System.out.println("Overflow condition");
}
storage[counter]=pushedElement;
counter++;
}
public void pop(){
//your code is here
if (counter==0){
System.out.println("Underflow condition");
}
counter--;
storage[counter]=0;
}
public void display(){
for (int i = 0 ; i<storage.length; i++){
System.out.println(storage[i]);
}
//your code is here
}
}