forked from menault/TD1_DEV51_Qualite_Algo
TD1
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// Heapsort Algorithm
|
||||
// M.Menault 2024
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -47,13 +46,12 @@ void heapsort(int* array, int length)
|
||||
{
|
||||
int i = 0;
|
||||
int temp_value = 0;
|
||||
|
||||
// Sift the current array (binary tree)
|
||||
|
||||
for(i=(length/2); i >= 0; i--)
|
||||
{
|
||||
sift(array,i,length);
|
||||
}
|
||||
// Heapsort !
|
||||
|
||||
for(i=length-1; i > 0; i--)
|
||||
{
|
||||
temp_value = array[i];
|
||||
|
Reference in New Issue
Block a user