Question: #include #include void mysort ( int * myarray ) ; int main ( ) { int n = 1 0 ; int * arr =
#include
#include
void mysortint myarray;
int main
int n ;
int arr int mallocn sizeofint;
if arr NULL
printfMemory not allocated.
;
return ;
arr;
arr;
arr;
arr;
arr;
arr;
arr;
arr;
arr;
arr;
int i ;
mysortarr;
for;i n;i
printfdarri;
freearr;
return ;
void mysortint myarray
forint j ;j;j
forint i j; i ; i
int k i;
if myarrayi myarrayk
int temp myarrayi;
myarrayi myarrayk;
myarrayk temp;
int temp myarrayj;
myarrayj myarray;
myarray temp;
why my code isnt exacly heap sort, it gives absolutely correct values in almost every value, if it is not heap sort what it is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
