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 ascii sort order?
Explain the internal working of a hash map?
what is the biggest advantage of linked lists?
Is array immutable?
How do we search a specific element in an array?
Tell me do array subscripts always start with zero?
What is a class user?
What is shell sort in data structure?
Why do we use hashmap?
Two linked lists are given, find out the sum of them without altering the linked list?
Is hashmap sorted?
What is the meaning of anonymous array? Explain with an example?
Which sorting is best and why?
What do you mean by union-by-weight?
What are the advantage of linked list over array?