Consider the following C code:
int getNextGap(int gap){
gap=(gap*10)/13;
if(gap<1)return 1;
return gap;
}
void mystery(int a[ ],int n){
int gap=n;
bool red=true;
while(gap!=1||red==true){
gap=getNextGap(gap);
red=false;
for(int i=0;i<(n-gap);i++){
if(a[i]>a[i+gap]){
swap(a[i],a[i+gap]);
red=true;
}
}
}
}
The array $A=\left \{ 9,4,-1,3,5,7,99,-33,104 \right \}$ passed in the above function , and n is number of array elements, then what output will print at last?
I mostly stuck how bool function working here. Plz help me out, how program executing:(