public void Setup() { var random = new Random(42); _priorities = new int[Size]; for (int i = 0; i < Size; i++) { _priorities[i] = random.Next(); } _priorityQueue = new PriorityQueue_InlineComparer <int, int>(initialCapacity: Size); }
public static void Simple_Priority_Queue() { var pq = new PriorityQueue_InlineComparer <string, int>(); pq.Enqueue("John", 1940); pq.Enqueue("Paul", 1942); pq.Enqueue("George", 1943); pq.Enqueue("Ringo", 1941); Assert.Equal("John", pq.Dequeue()); Assert.Equal("Ringo", pq.Dequeue()); Assert.Equal("Paul", pq.Dequeue()); Assert.Equal("George", pq.Dequeue()); }
public void Initialize() { var random = new Random(42); _priorities = new int[2 * Size]; for (int i = 0; i < 2 * Size; i++) { _priorities[i] = random.Next(); } _priorityQueueBinary = new PriorityQueue_Binary <int, int>(initialCapacity: Size); _priorityQueueComparable = new PriorityQueue_Comparable <int, int>(initialCapacity: Size); _priorityQueueInlineComparer = new PriorityQueue_InlineComparer <int, int>(initialCapacity: Size); _priorityQueue2 = new PriorityQueue <int>(initialCapacity: Size); _priorityQueue = new PriorityQueue <int, int>(initialCapacity: Size); _prioritySet = new PrioritySet <int, int>(initialCapacity: Size); _pairingHeap = new PairingHeap <int, int>(Comparer <int> .Default); }