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 bubble sort algorithm?
State the different types of linked lists?
Why it is said that searching a node in a binary search tree is efficient than that of a simple binary tree?
What is difference between capacity and size of arraylist?
Discuss the difference between a stack and an Array?
Define a complete binary tree?
Why linked list is required?
Which is faster arraylist or hashmap?
What is rule regarding overriding equals and hascode method?
What are the 4 types of data?
Does list allow null values?
Explain how is linked list implemented?
Is hashmap get thread safe?
Define threaded binary tree.
Can we use any class as map key?