simple algorithm for bubble sort?
Answer / 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 |
How to do the intersection of two sorted arrays?
What is difference between for loop and foreach?
Can hashmap store null values?
Differentiate stack from array?
How do you sort pseudocode?
What is the complexity of sorting algorithm?
Which is faster quick sort or merge sort?
What are the main differences between the linked list and linear array?
What are different dynamic memory allocation technique in c.
What is the maximum size of array?
example of linear and non-linear data structures?
Are dictionaries mutable?