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 complexity of selection sort?
What is an object array?
How do you use merge sort?
List the two important key points of depth first search?
Which is the simplest file structure?
What is data structure and why it is important?
What are the types of linked list?
What is the difference between hashset and hashtable?
How is the front of the queue calculated ?
What is a graph?
What are the four characteristics of algorithms?
How does insertion sort works?
what is the difference between Linear Array and Linked List?
How do I remove a value from a list?
What is the difference between linked list and array?