예제 #1
0
 public HeapIterator()
 {
     if (Comparer == null)
     {
         copy = new MinPQ <Key>(Size);
     }
     else
     {
         copy = new MinPQ <Key>(Size, Comparer);
     }
     for (int i = 0; i < N; N++)
     {
         copy.Insert(PQ[i]);
     }
 }
예제 #2
0
        public LazyPrimMST(EdgeWeightedGraph G)
        {
            mst    = new Queue <Edge>();
            marked = new bool[G.GetVertices()];
            Comparer <Edge> comparer = Comparer <Edge> .Default;

            pq = new MinPQ <Edge>(1, comparer);

            for (int v = 0; v < G.GetVertices(); v++)
            {
                // to do
                if (!marked[v])
                {
                    Prim(G, v);
                }
            }
        }
예제 #3
0
            public HeapIterator(Comparer <Key> Comparer, int Size, int N, Key[] PQ)
            {
                this.Comparer = Comparer;
                this.Size     = Size;
                this.N        = N;
                this.PQ       = PQ;

                if (Comparer == null)
                {
                    copy = new MinPQ <Key>(Size);
                }
                else
                {
                    copy = new MinPQ <Key>(Size, Comparer);
                }
                for (int i = 0; i <= N; i++)
                {
                    copy.Insert(this.PQ[i]);
                }
            }