Пример #1
0
		public static void Test(){
			var a = new int[] { 23, 12, 9, 30, 2, 1, 50 };
			MinPQ pq = new MinPQ(a);
			foreach(var i in pq.PQ()){
				Out(i+" ");
			}
		}
Пример #2
0
	public IEnumerable<int> KSE_MinHeap(int[] A, int K){
		var heap = new int[K];
		for(int i=0; i<heap.Length; i++)
			heap[i] = A[i];
		var pq = new MinPQ(heap);
		for(int i=K; i<A.Length; i++)
			pq.InsertAtTop(A[i]);
		foreach(var i in pq.PQ())
			yield return i;
	}