public BinaryHeapPriorityQueue <E> DeepCopy(MapFactory <E, Entry <E> > mapFactory) { var queue = new BinaryHeapPriorityQueue <E>(mapFactory); foreach (Entry <E> entry in keyToEntry.Values) { queue.RelaxPriority(entry.key, entry.priority); } return(queue); }
public List <E> ToSortedList() { var sortedList = new List <E>(Size()); BinaryHeapPriorityQueue <E> queue = this.DeepCopy(); while (!queue.IsEmpty()) { sortedList.Add(queue.RemoveFirst()); } return(sortedList); }