(CircularQueue cq)
| 20 | } |
| 21 | |
| 22 | static int Delete(CircularQueue cq) { |
| 23 | if (cq.first == null) { |
| 24 | System.out.printf ("Circular Queue is empty"); |
| 25 | return Integer.MIN_VALUE; |
| 26 | } |
| 27 | |
| 28 | int value; |
| 29 | |
| 30 | if (cq.first == cq.last) { |
| 31 | value = cq.first.value; |
| 32 | cq.first = null; |
| 33 | cq.last = null; |
| 34 | } else { |
| 35 | Node n = cq.first; |
| 36 | value = n.value; |
| 37 | cq.first = cq.first.link; |
| 38 | cq.last.link = cq.first; |
| 39 | } |
| 40 | |
| 41 | return value ; |
| 42 | } |
| 43 | |
| 44 | static void displayCircularQueue( CircularQueue cq) { |
| 45 | Node n = cq.first; |