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 a Breadth First Search? Give a few of its applications.
What data structure underlies a python list?
What is a hash in programming?
Which is better than array and linked list?
Explain the term binding time?
What do u mean by array?
Explain what are the major data structures used in the network data model?
What is the difference between hashset and linkedhashset?
What is merge sort and how it works?
Define non linear data structure.
Is hashtable fail fast?
What exactly is a thread?
What is difference between rb tree and avl tree?
Can we remove element from arraylist while iterating?
Is array a data type?