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
What are the applications of graph data structure?
What is the difference between sorting and classifying?
Compare Queue and Topic ?
Can arraylist shrink?
Define articulation point?
What is the meaning of arraylist?
What is difference between list and set?
How memory is reserved using a declaration statement ?
Differentiate file structure from storage structure?
What is the impact of signed numbers on the memory?
What are the types of binary tree?
Why using cookie to store session info is a better idea than just using session info in the request?
What is basic data structure?
What are linked list?
Can I provide array size dynamically?