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
List the differences between comparable and comparator interface?
What are types of Collision Resolution Techniques and the methods used in each of the types?
How to traverse data in a linked list in forward and backward direction, write the algorithm?
Explain about map and their types?
What is a treeset?
What is the meaning of anonymous array? Explain with an example?
What do you mean by Runtime Error
Do you know what is linear search?
What do you mean by complexity of search algorithm?
What are the disadvantages array implementations of linked list?
How can you insert a node to the beginning of a singly linked list?
What is garbage collection in data structure?
What is the difference between classifying and sorting?
Define in brief an array.
Define path in a graph?