Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write programs for Bubble Sort, Quick sort

Answer Posted / siya

#include<stdio.h>
#include<conio.h>
void main()
{
int a[20],n,i,j,temp;
printf("\n\nEnter the total number of eleents:");
scanf("%d",&n);
printf("\n\nEnter the array elements:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
/* sorting */
for(i=0;i<n;i++)
{
for(j=i;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j+1];
a[j+1]=a[j];
a[j]=temp;
}
}
}
printf("\n\nThe sorted array:");
for(i=0;i<n;i++)
printf("%d ",a[i]);
}

Is This Answer Correct ?    36 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the Differences between map and hashmap?

1001


What is the best case complexity of quicksort?

901


How is any data structure application is classified among files?

1047


What is mean by selection sort?

880


What is data structure? Explain.

986


State the advantages of using postfix notations?

1055


When will we get ArrayStoreException?

1164


Can we change load factor of hashmap?

880


What are the major data structures used in the following areas : network data model & hierarchical data model?

1025


What is a multiset table?

858


What is the difference between hashmap and treemap?

887


What are examples of data structures?

925


Are sets sorted?

892


What is difference between map and hashmap?

1012


Define a Deque?

1047