We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 35b90b5 commit f9a5daeCopy full SHA for f9a5dae
src/Advanced.Algorithms/Sorting/HeapSort.cs
@@ -14,11 +14,7 @@ public class HeapSort<T> where T : IComparable
14
public static T[] Sort(T[] array)
15
{
16
//heapify
17
- var heap = new BMinHeap<T>();
18
- foreach (var item in array)
19
- {
20
- heap.Insert(item);
21
- }
+ var heap = new BMinHeap<T>(array);
22
23
//now extract min until empty and return them as sorted array
24
var sortedArray = new T[array.Length];
0 commit comments