public TValue Peek() { PriorityQueueNode <TKey, TValue> firstElement = queue.First(); return(firstElement.Item); }
public int CompareTo(PriorityQueueNode <TKey, TValue> other) { return(Priority.CompareTo(other.Priority)); }
/// <summary> /// placerar en input längst bak i kön med bestämd prioritet /// </summary> /// <param name="item">ny input</param> /// <param name="order"></param> public void Enqueue(TValue item, TKey order) { PriorityQueueNode <TKey, TValue> node = new PriorityQueueNode <TKey, TValue>(item, order); queue.Add(node); }
//Lägger till ett element i kön public void Enqueue(TValue item, TKey order) { PriorityQueueNode <TKey, TValue> Nod = new PriorityQueueNode <TKey, TValue>(item, order); Heapen.Add(Nod); }
public TValue Peek() { PriorityQueueNode <TKey, TValue> tmpQ = tmpQ = _queue.peek(); return(tmpQ.Item); }
public void Enqueue(TValue item, TKey order) { PriorityQueueNode <TKey, TValue> _new = new PriorityQueueNode <TKey, TValue>(item, order); _queue.Add(_new); }
public void Dequeue() { PriorityQueueNode <TKey, TValue> tmpQ = tmpQ = _queue.peek(); _queue.Remove(tmpQ); }