Ejemplo n.º 1
0
        internal static RankedTree <a> link <a>(IComparer <a> comparer, RankedTree <a> _arg2, RankedTree <a> _arg1)
        {
            RankedTree <a> rankedTree1 = _arg2;
            a   x   = rankedTree1.item2;
            int num = rankedTree1.item1;
            FSharpList <RankedTree <a> > fsharpList1 = rankedTree1.item3;
            RankedTree <a> rankedTree2 = _arg1;
            a y = rankedTree2.item2;
            FSharpList <RankedTree <a> > fsharpList2 = rankedTree2.item3;

            if (BinomialHeap.LTGTEQ(comparer.Compare(x, y)) is FSharpChoice <Unit, Unit, Unit> .Choice2Of3)
            {
                return(RankedTree <a> .NewNode(num + 1, y, FSharpList <RankedTree <a> > .Cons(rankedTree1, fsharpList2)));
            }
            return(RankedTree <a> .NewNode(num + 1, x, FSharpList <RankedTree <a> > .Cons(rankedTree2, fsharpList1)));
        }
Ejemplo n.º 2
0
        public static BinomialHeap <a> insert <a>(a x, BinomialHeap <a> heap)
        {
            FSharpList <RankedTree <a> > heap1 = BinomialHeap.insertTree <a>(heap.Comparer, RankedTree <a> .NewNode(0, x, FSharpList <RankedTree <a> > .get_Empty()), heap.Heap);

            return(new BinomialHeap <a>(heap.Comparer, heap1));
        }