Beispiel #1
0
        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);
        }
Beispiel #2
0
        public List <E> ToSortedList()
        {
            var sortedList = new List <E>(Size());
            BinaryHeapPriorityQueue <E> queue = this.DeepCopy();

            while (!queue.IsEmpty())
            {
                sortedList.Add(queue.RemoveFirst());
            }
            return(sortedList);
        }