OS Data Structures Question:

Download Job Interview Questions and Answers PDF

Explain simple algorithm for bubble sort?

OS Data Structures Interview Question
OS Data Structures Interview Question

Answer:

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;
}
}
}

Download OS Data Structures Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me applications of linked lists and mostly used linked list?Explain applications of stacks and their uses?