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 |
Define indegree of a graph?
How does a treemap sort?
Why hashmap is faster than hashset?
What is an algorithm in coding?
What is the difference between length () and size () of arraylist?
Explain the principle of quicksort. What is its complexity?
What is data type in data structure?
What are linked lists good for?
Differentiate between the singly linked list and doubly linked list.
What do you mean by 2-3-4 tree?
What is reduction to sorting method?
applications of stacks and their uses?