更新循环队列遍历for循环条件
This commit is contained in:
parent
73c2c856ed
commit
7f702254ca
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user