Write programs for Bubble Sort, Quick sort

Answer Posted / nitin jatpuriya

//PROGRAM FOR BUBBLE SORT

#include<stdio.h>
#include<conio.h>
#define SIZE 5
void main()
{
int a[SIZE],n,i,j,temp;
clrscr();
printf("enter the elements ");
for(i=0;i<SIZE;i++)
scanf("%d",&a[i]);
printf("the sorted list is :->\n");
for(i=0;i<SIZE;i++)
for(j=i;j<SIZE-i;j++)
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}

for(i=0;i<SIZE;i++)
printf("%d",a[i]);
getch();
}

Is This Answer Correct ?    174 Yes 94 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the applications of graph data structure?

474


What is the difference between sorting and classifying?

475


Compare Queue and Topic ?

659


Can arraylist shrink?

484


Define articulation point?

713






What is the meaning of arraylist?

488


What is difference between list and set?

460


How memory is reserved using a declaration statement ?

656


Differentiate file structure from storage structure?

506


What is the impact of signed numbers on the memory?

527


What are the types of binary tree?

492


Why using cookie to store session info is a better idea than just using session info in the request?

544


What is basic data structure?

503


What are linked list?

551


Can I provide array size dynamically?

521