Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started