-
Notifications
You must be signed in to change notification settings - Fork 28
/
QueueCircularArrayDemo.java
55 lines (47 loc) · 1 KB
/
QueueCircularArrayDemo.java
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package ds_004_stacks_and_queues;
public class QueueCircularArrayDemo {
public static void main(String[] args) {
QueueCircularArray<Integer> queue = new QueueCircularArray<>();
Integer value;
queue.print();
queue.state();
//
// queue.enqueue(10);
// queue.print();
// queue.state();
//
// value = queue.dequeue();
// System.out.println("Dequeued: " + value);
// queue.print();
// queue.state();
//
// queue.enqueue(10);
// queue.enqueue(20);
//
// queue.print();
// queue.state();
//
// value = queue.dequeue();
// System.out.println("Dequeued: " + value);
// queue.print();
// queue.state();
//
// value = queue.dequeue();
// System.out.println("Dequeued: " + value);
// queue.print();
// queue.state();
queue.enqueue(10);
queue.enqueue(20);
queue.enqueue(30);
queue.enqueue(40);
queue.enqueue(50);
queue.enqueue(60);
queue.enqueue(70);
queue.enqueue(80);
queue.print();
queue.dequeue();
queue.print();
queue.enqueue(90);
queue.print();
}
}