Esempio n. 1
0
 // add all items to copy of heap
 // takes linear time since already in heap order so no Keys move
 public HeapIndexMinPQEnumerator(int n, int[] pq, T[] keys)
 {
     _copy = new IndexMinPQ <T>(pq.Length - 1);
     for (var i = 1; i <= n; i++)
     {
         _copy.Insert(pq[i], keys[pq[i]]);
     }
 }
Esempio n. 2
0
        public Multiway(List <List <string> > lists)
        {
            var n = lists.Sum(l => l.Count);

            _n  = n;
            _pq = new IndexMinPQ <string>(n);

            foreach (var list in lists)
            {
                InsertWords(list);
            }
        }