コード例 #1
0
ファイル: FibonacciMinHeap.cs プロジェクト: zack7891/DSA
        /// <summary>
        /// Merges the elements of the <see cref="FibonacciMinHeap{T}"/> with the other given <see cref="FibonacciMinHeap{T}"/>. The other <see cref="FibonacciMinHeap{T}"/> is cleared after the merging.
        /// </summary>
        /// <param name="otherMinHeap">The other <see cref="FibonacciMinHeap{T}"/> used for merging.</param>
        public void Merge(FibonacciMinHeap <T> otherMinHeap)
        {
            minNode = MergeNodeLists(minNode, otherMinHeap.minNode);
            Count  += otherMinHeap.Count;

            otherMinHeap.Clear();
        }
コード例 #2
0
        /// <summary>
        /// Returns a new <see cref="FibonacciMinHeap{T}"/> containing the elements of the <see cref="FibonacciMaxHeap{T}"/>.
        /// </summary>
        /// <returns>Returns a new <see cref="FibonacciMinHeap{T}"/> containing the elements of the <see cref="FibonacciMaxHeap{T}"/>.</returns>
        public FibonacciMinHeap <T> ToMinHeap()
        {
            var minHeap = new FibonacciMinHeap <T>();

            minHeap.Heapify(ToArray());
            return(minHeap);
        }