File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ PROGRAMS = m_based \
52
52
imath_demo \
53
53
random_demo \
54
54
k-means_demo \
55
- kmp_demo
55
+ kmp_demo \
56
+ heap_sort_demo
56
57
57
58
all : $(PROGRAMS )
58
59
Original file line number Diff line number Diff line change @@ -33,23 +33,23 @@ namespace alg
33
33
Heap<T> heap (number_of_elements);
34
34
int i;
35
35
36
- /* In order to build a heap structure from input array*/
36
+ // In order to build a heap structure from input array
37
37
for (i=0 ;i<number_of_elements;i++)
38
38
{
39
- heap.insert (array[i],0 ); // set key with the value of the array,value to 0(no use)
39
+ heap.insert (array[i],0 ); // set key with the value of the array,value to 0(no use)
40
40
}
41
41
42
- /* Temporary array to store the minkey of each step,which is deleted from the heap*/
42
+ // Temporary array to store the minkey of each step,which is deleted from the heap
43
43
T tempArray[number_of_elements];
44
44
for (i=0 ;i<number_of_elements;i++)
45
45
{
46
- tempArray[i]=heap.min_key (); // find the min key
47
- heap.delete_min ();
46
+ tempArray[i]=heap.min_key (); // find the min key
47
+ heap.delete_min ();
48
48
}
49
49
50
50
for (i=0 ;i<number_of_elements;i++)
51
51
{
52
- array[i]=tempArray[i]; // copy back to the original array
52
+ array[i]=tempArray[i]; // copy back to the original array
53
53
}
54
54
}
55
55
}
You can’t perform that action at this time.
0 commit comments