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


Please Help Members By Posting Answers For Below Questions

What is ascii sort order?

464


Explain the internal working of a hash map?

511


what is the biggest advantage of linked lists?

562


Is array immutable?

509


How do we search a specific element in an array?

555






Tell me do array subscripts always start with zero?

508


What is a class user?

560


What is shell sort in data structure?

479


Why do we use hashmap?

535


Two linked lists are given, find out the sum of them without altering the linked list?

560


Is hashmap sorted?

513


What is the meaning of anonymous array? Explain with an example?

749


Which sorting is best and why?

499


What do you mean by union-by-weight?

577


What are the advantage of linked list over array?

457