Fixato bug e implementato alcune funzioni.
This commit is contained in:
42
com/xgiovio/HeapPrioriyQueueTest.java
Normal file
42
com/xgiovio/HeapPrioriyQueueTest.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.xgiovio;
|
||||
|
||||
import com.xgiovio.general_utility.test_object;
|
||||
import priorityqueue.heap.HeapPriorityQueue;
|
||||
import stack.NodeStack;
|
||||
import utility.DefaultComparator;
|
||||
|
||||
/**
|
||||
* Created with xgiovio.macbookair.
|
||||
* User: xgiovio
|
||||
* Date: 23/03/14
|
||||
* Time: 20:37
|
||||
*/
|
||||
public class HeapPrioriyQueueTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Integer[] b = new Integer[5] ;
|
||||
b[0] = new Integer(7);
|
||||
b[1] = new Integer(5);
|
||||
b[2] = new Integer(-8);
|
||||
b[3] = new Integer(8);
|
||||
b[4] = new Integer(-2);
|
||||
|
||||
String[] c = new String[5] ;
|
||||
c[0] = new String("ale");
|
||||
c[1] = new String("ale");
|
||||
c[2] = new String("ale");
|
||||
c[3] = new String("ale");
|
||||
c[4] = new String("ale");
|
||||
|
||||
|
||||
|
||||
HeapPriorityQueue<Integer,String> a = new HeapPriorityQueue<Integer, String> (b,c, new DefaultComparator<Integer>());
|
||||
|
||||
System.out.println(a.min().getKey());
|
||||
System.out.println(a);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,22 @@
|
||||
package com.xgiovio;
|
||||
|
||||
import position.NodePositionList;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
NodePositionList<Integer> a = new NodePositionList<Integer>();
|
||||
a.addLast(1);
|
||||
a.addLast(2);
|
||||
Iterator<Integer> it = a.iterator();
|
||||
a.addLast(3);
|
||||
a.addLast(4);
|
||||
|
||||
for (;it.hasNext();)
|
||||
System.out.println(it.next());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user