コード例 #1
0
 public FibonacciHeap(HeapDirection Direction, Func <TPriority, TPriority, int> priorityComparison)
 {
     nodes                   = new FibonacciHeapLinkedList <TPriority, TValue>();
     degreeToNode            = new Dictionary <int, FibonacciHeapCell <TPriority, TValue> >();
     DirectionMultiplier     = (short)(Direction == HeapDirection.Increasing ? 1 : -1);
     this.direction          = Direction;
     this.priorityComparsion = priorityComparison;
     count                   = 0;
 }
コード例 #2
0
        internal void MergeLists(FibonacciHeapLinkedList <TPriority, TValue> list)
        {
            Contract.Requires(list != null);

            if (list.First != null)
            {
                if (last != null)
                {
                    last.Next = list.first;
                }
                list.first.Previous = last;
                last = list.last;
                if (first == null)
                {
                    first = list.first;
                }
            }
        }