// 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]); } }
public TopM(ICollection <string> a) { _m = a.Count; _pq = new MinPQ <Transaction>(_m + 1); InsertTransactions(a); }