/// <summary> /// Returns a new <see cref="FibonacciMaxHeap{T}"/> containing the elements of the <see cref="FibonacciMinHeap{T}"/>. /// </summary> /// <returns>Returns a new <see cref="FibonacciMaxHeap{T}"/> containing the elements of the <see cref="FibonacciMinHeap{T}"/>.</returns> public FibonacciMaxHeap <T> ToMaxHeap() { var maxHeap = new FibonacciMaxHeap <T>(); maxHeap.Heapify(ToArray()); return(maxHeap); }
/// <summary> /// Merges the elements of the <see cref="FibonacciMaxHeap{T}"/> with the other given <see cref="FibonacciMaxHeap{T}"/>. The other <see cref="FibonacciMaxHeap{T}"/> is cleared after the merging. /// </summary> /// <param name="otherMaxHeap">The other <see cref="FibonacciMaxHeap{T}"/> used for merging.</param> public void Merge(FibonacciMaxHeap <T> otherMaxHeap) { maxNode = MergeNodeLists(maxNode, otherMaxHeap.maxNode); Count += otherMaxHeap.Count; otherMaxHeap.Clear(); }