Answer Posted / siri
void bubble(int x[],int n)
{
int hold,j,pass;
int switched=true;
for(pass=0;pass<n-1&&switched=true;pass++){
switched=false;
for(j=0;j<n-pass-1;j++)
if(x[j]>x[j+1]){
switched=true;
hold=x[j];
x[j]=x[j+1];
x[j+1]=hold;
}
}
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Why do we need to recycle?
Is linked list faster than array?
How does a binary search work?
Explain about set and their types in a collection?
What is bubble sort technique?
How will you free the memory that is allocated at run time?
What is a Stack? Explain with example?
Which sorting algorithm uses minimum number of swaps?
Is an arraylist a vector?
What do you mean by general trees?
When is a binary search best applied?
What is sorting with example?
Devise a program to sort an array using bubble sort.
Can I provide array size dynamically?
Explain what are the major data structures used in the hierarchical data model?