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 is the maximum size of array?
How is the front of the queue calculated in data structure?
Does arraylist have index?
Explain circular linked list?
What is the meaning of anonymous array? Explain with an example?
What is variable size arrays?and why we use it?
Does arraylist extend list?
What is a subtree?
Is treemap sorted?
What is an object array?
How does quicksort partition work?
Difference between hashset and treeset?
Define terminal nodes in a tree?
Describe tree database.
Define shortest path?