Пример #1
0
 // add all items to copy of heap
 // takes linear time since already in heap order so no Keys move
 public HeapMinPQEnumerator(IComparer <T> comparator, int size, int n, IList <T> pq)
 {
     _copy = comparator == null ? new MinPQ <T>(size) : new MinPQ <T>(size, comparator);
     for (var i = 1; i <= n; i++)
     {
         _copy.Insert(pq[i]);
     }
 }
Пример #2
0
 public TopM(ICollection <string> a)
 {
     _m  = a.Count;
     _pq = new MinPQ <Transaction>(_m + 1);
     InsertTransactions(a);
 }