auto commit

This commit is contained in:
CyC2018
2018-04-09 11:52:30 +08:00
parent a589bd22a5
commit bee393f64d
2 changed files with 4 additions and 4 deletions

View File

@ -393,15 +393,15 @@ public void push(int node) {
in.push(node);
}
public int pop() throws Exception{
public int pop() {
if (out.isEmpty()) {
while (!in.isEmpty()) {
out.push(in.pop());
}
if (out.isEmpty()){
}
if (out.isEmpty()){
throw new Exception("queue is empty");
}
}
return out.pop();
}
```