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

Define terminal nodes in a tree?

995


How does a selection sort work?

824


Explain extended binary tree.

921


What is scalar example?

922


List the types of rotations available in splay tree?

1119


What is integer max_value?

833


How do stacks work?

881


Why do we Use a Multidimensional Array?

852


Can you tell me the differences between Array and ArrayList?

1013


What is a Breadth First Search? Give a few of its applications.

855


What are control structures?

914


What is sequential search? What is the average number of comparisons in a sequential search?

784


Which sorting is used in collections sort?

836


How do you sort an array by value?

806


What is collections singletonlist?

841