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
What do u mean by data type?
Define a priority queue?
How do you sort a collection in descending order?
Which sorting method is slowest?
Can we add elements to final list?
How to find 3rd element from end in a linked list in one pass?
How will you reverse Linked List.
Define a binary tree?
What is the Insertion Sort Code?.
Can we store a string and integer together in an array?
How can we reverse the order in the treemap?
Can hashset contain null?
What do you mean by separate chaining?
Does hashmap maintain insertion order?
How would you use bsearch() function to search a name stored in array of pointers to string?