public static a findMin <a>(BinomialHeap <a> _arg1) { BinomialHeap <a> binomialHeap = _arg1; FSharpList <RankedTree <a> > heap = binomialHeap.Heap; return(BinomialHeap.root <a>(BinomialHeap.removeMinTree <a>(binomialHeap.Comparer, heap).Item1)); }
internal static Tuple <RankedTree <a>, FSharpList <RankedTree <a> > > removeMinTree <a>(IComparer <a> comparer, FSharpList <RankedTree <a> > heap) { FSharpList <RankedTree <a> > fsharpList1 = heap; if (fsharpList1.get_TailOrNull() == null) { throw new InvalidOperationException("The heap is empty."); } FSharpList <RankedTree <a> > fsharpList2 = fsharpList1; if (fsharpList2.get_TailOrNull().get_TailOrNull() == null) { return(new Tuple <RankedTree <a>, FSharpList <RankedTree <a> > >(fsharpList2.get_HeadOrDefault(), FSharpList <RankedTree <a> > .get_Empty())); } FSharpList <RankedTree <a> > tailOrNull = fsharpList2.get_TailOrNull(); RankedTree <a> headOrDefault = fsharpList2.get_HeadOrDefault(); Tuple <RankedTree <a>, FSharpList <RankedTree <a> > > tuple = BinomialHeap.removeMinTree <a>(comparer, tailOrNull); FSharpList <RankedTree <a> > fsharpList3 = tuple.Item2; RankedTree <a> rankedTree = tuple.Item1; FSharpChoice <Unit, Unit, Unit> fsharpChoice = BinomialHeap.LTGTEQ(comparer.Compare(BinomialHeap.root <a>(headOrDefault), BinomialHeap.root <a>(rankedTree))); if (fsharpChoice is FSharpChoice <Unit, Unit, Unit> .Choice1Of3 || fsharpChoice is FSharpChoice <Unit, Unit, Unit> .Choice3Of3) { return(new Tuple <RankedTree <a>, FSharpList <RankedTree <a> > >(headOrDefault, tailOrNull)); } return(new Tuple <RankedTree <a>, FSharpList <RankedTree <a> > >(rankedTree, FSharpList <RankedTree <a> > .Cons(headOrDefault, fsharpList3))); }