Skip to content

Commit

Permalink
Merge pull request #14 from fei028/master
Browse files Browse the repository at this point in the history
link queue bug xg
  • Loading branch information
zavier authored Feb 26, 2017
2 parents f63ec74 + 4378cd8 commit 2cb892a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ else if(index == (size - 1)){
else {
element = removeMiddle(index);
}
size--;
return element;
}

Expand Down Expand Up @@ -95,6 +94,7 @@ public void addFirst(Object o){
node.data = o;
node.next = head.next;
head = node;
size++;
}
public void addLast(Object o){
Node node = new Node();
Expand All @@ -116,6 +116,7 @@ private Object removeMiddle(int index) {
Object element = removeNode.data;
temp.next = removeNode.next;
removeNode = null;
size--;
return element;
}

Expand Down Expand Up @@ -190,6 +191,7 @@ private Object removeLastNode() {
Object element = lastNode.data;
lastNode = null;
last = node;
size--;
return element;
}
/**
Expand All @@ -201,6 +203,7 @@ private Object removeFirstNode() {
Object element = head.data;
head = null;
head = node;
size--;
return element;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public void enQueue(Object o){

public Object deQueue(){
checkEmptyQueue();
return linkedList.remove(size() - 1);
return linkedList.remove(0);
}

public boolean isEmpty(){
Expand Down

0 comments on commit 2cb892a

Please sign in to comment.