Answer the question
In order to leave comments, you need to log in
The function doesn't work. What to do?
void swap(int *a,int *b){
int temp=*a;
*a=*b;
*b=temp;
}
int parent(int i){
return (i-1)/2;
}
void shitf_up(binary_tree *s,int pos){
int Parent=parent(pos);
if (pos>0 && (s->val[pos] > s->val[Parent])){
swap(&s->val[pos],&s->val[Parent]);
shitf_up(&s,Parent);
}
return;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question