摘要: 1 public class MyPriorityQueue{ 2 private Heap heap = new Heap(); 3 4 public void enqueue(E newObject){ 5 heap.add(newObject); 6 } 7 8 public E dequeue(){ 9 return heap.remove();10 }11 12 public int getSize(){13 return heap.getSize();14 ... 阅读全文
posted @ 2013-11-12 14:46 soul390 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 1 public class GenericQueue { 2 private java.util.LinkedList list 3 = new java.util.LinkedList(); 4 5 public void enqueue(E e){ 6 list.addLast(e); 7 } 8 9 public E dequeue(){10 return list.removeFirst();11 }12 13 public int getSize(){14 ... 阅读全文
posted @ 2013-11-12 14:13 soul390 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1 public class MyLinkedList extends MyAbstractList { 2 private Node head, tail; 3 4 /** Create a default list */ 5 public MyLinkedList() { 6 } 7 8 /** Create a list from an array of objects */ 9 public MyLinkedList(E[] objects) { 10 super(objects); 11 } 12 13 /** Ret... 阅读全文
posted @ 2013-11-12 11:25 soul390 阅读(160) 评论(0) 推荐(0) 编辑