更新循环队列遍历for循环条件

This commit is contained in:
staresgroup 2019-09-02 21:37:19 +08:00
parent 73c2c856ed
commit 7f702254ca

View File

@ -37,7 +37,7 @@ public class CircularQueue {
public void printAll() { public void printAll() {
if (0 == n) return; if (0 == n) return;
for (int i = head; i % n != tail; ++i) { for (int i = head; i % n != tail; i = (i + 1) % n) {
System.out.print(items[i] + " "); System.out.print(items[i] + " ");
} }
System.out.println(); System.out.println();