Merge pull request #40 from Liam0205/bugfix_java_09_queue
[JAVA][09_queue] bugfix and typofix.
This commit is contained in:
commit
a7d5144a58
@ -36,7 +36,8 @@ public class CircularQueue {
|
||||
}
|
||||
|
||||
public void printAll() {
|
||||
for (int i = head; i < tail; ++i) {
|
||||
if (0 == n) return;
|
||||
for (int i = head; i % n != tail; ++i) {
|
||||
System.out.print(items[i] + " ");
|
||||
}
|
||||
System.out.println();
|
||||
|
@ -3,7 +3,7 @@ package queue;
|
||||
/**
|
||||
* Created by wangzheng on 2018/10/9.
|
||||
*/
|
||||
public class DynimacArrayQueue {
|
||||
public class DynamicArrayQueue {
|
||||
// 数组:items,数组大小:n
|
||||
private String[] items;
|
||||
private int n = 0;
|
||||
@ -12,7 +12,7 @@ public class DynimacArrayQueue {
|
||||
private int tail = 0;
|
||||
|
||||
// 申请一个大小为capacity的数组
|
||||
public DynimacArrayQueue(int capacity) {
|
||||
public DynamicArrayQueue(int capacity) {
|
||||
items = new String[capacity];
|
||||
n = capacity;
|
||||
}
|
Loading…
Reference in New Issue
Block a user