Beispiel #1
0
        public static FSharpList <RankedTree <a> > insertTree <a>(IComparer <a> comparer, RankedTree <a> t, FSharpList <RankedTree <a> > ts)
        {
            while (true)
            {
                FSharpList <RankedTree <a> > fsharpList1 = ts;
                if (fsharpList1.get_TailOrNull() != null)
                {
                    FSharpList <RankedTree <a> > fsharpList2 = fsharpList1;
                    FSharpList <RankedTree <a> > tailOrNull  = fsharpList2.get_TailOrNull();
                    RankedTree <a> headOrDefault             = fsharpList2.get_HeadOrDefault();
                    if (BinomialHeap.rank <a>(t) >= BinomialHeap.rank <a>(headOrDefault))
                    {
                        IComparer <a>  comparer1  = comparer;
                        RankedTree <a> rankedTree = BinomialHeap.link <a>(comparer, t, headOrDefault);
                        ts       = tailOrNull;
                        t        = rankedTree;
                        comparer = comparer1;
                    }
                    else
                    {
                        goto label_3;
                    }
                }
                else
                {
                    break;
                }
            }
            return(FSharpList <RankedTree <a> > .Cons(t, FSharpList <RankedTree <a> > .get_Empty()));

label_3:
            return(FSharpList <RankedTree <a> > .Cons(t, ts));
        }
Beispiel #2
0
        public static FSharpList <RankedTree <a> > mergeTrees <a>(IComparer <a> comparer, FSharpList <RankedTree <a> > _arg1_0, FSharpList <RankedTree <a> > _arg1_1)
        {
            Tuple <FSharpList <RankedTree <a> >, FSharpList <RankedTree <a> > > tuple = new Tuple <FSharpList <RankedTree <a> >, FSharpList <RankedTree <a> > >(_arg1_0, _arg1_1);
            FSharpList <RankedTree <a> > fsharpList1;

            if (tuple.Item2.get_TailOrNull() != null)
            {
                FSharpList <RankedTree <a> > fsharpList2 = tuple.Item2;
                if (tuple.Item1.get_TailOrNull() != null)
                {
                    FSharpList <RankedTree <a> > fsharpList3 = tuple.Item1;
                    FSharpList <RankedTree <a> > tailOrNull1 = fsharpList2.get_TailOrNull();
                    FSharpList <RankedTree <a> > fsharpList4 = tuple.Item2;
                    FSharpList <RankedTree <a> > tailOrNull2 = fsharpList3.get_TailOrNull();
                    FSharpList <RankedTree <a> > fsharpList5 = tuple.Item1;
                    RankedTree <a> headOrDefault1            = fsharpList2.get_HeadOrDefault();
                    RankedTree <a> headOrDefault2            = fsharpList3.get_HeadOrDefault();
                    int            num1 = BinomialHeap.rank <a>(headOrDefault2);
                    int            num2 = BinomialHeap.rank <a>(headOrDefault1);
                    FSharpChoice <Unit, Unit, Unit> fsharpChoice = BinomialHeap.LTGTEQ(num1 >= num2 ? (num1 > num2 ? 1 : 0) : -1);
                    if (fsharpChoice is FSharpChoice <Unit, Unit, Unit> .Choice2Of3)
                    {
                        return(FSharpList <RankedTree <a> > .Cons(headOrDefault1, BinomialHeap.mergeTrees <a>(comparer, fsharpList5, tailOrNull1)));
                    }
                    if (!(fsharpChoice is FSharpChoice <Unit, Unit, Unit> .Choice3Of3))
                    {
                        return(FSharpList <RankedTree <a> > .Cons(headOrDefault2, BinomialHeap.mergeTrees <a>(comparer, tailOrNull2, fsharpList4)));
                    }
                    return(BinomialHeap.insertTree <a>(comparer, BinomialHeap.link <a>(comparer, headOrDefault2, headOrDefault1), BinomialHeap.mergeTrees <a>(comparer, tailOrNull2, tailOrNull1)));
                }
                fsharpList1 = tuple.Item2;
            }
            else
            {
                fsharpList1 = tuple.Item1;
            }
            return(fsharpList1);
        }