(CircularQueue cq, int value)
| 8 | static class CircularQueue {Node first, last;} |
| 9 | |
| 10 | static void Insert(CircularQueue cq, int value) { |
| 11 | Node n = new Node(); |
| 12 | n.value = value; |
| 13 | |
| 14 | if (cq.first == null) { |
| 15 | cq.first = n; |
| 16 | } else { cq.last .link = n; } |
| 17 | |
| 18 | cq.last = n; |
| 19 | cq.last.link = cq.first; |
| 20 | } |
| 21 | |
| 22 | static int Delete(CircularQueue cq) { |
| 23 | if (cq.first == null) { |