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

Mention a few applications of linked lists?

877


Parenthesis is never required in postfix or prefix expressions, why?

838


What do you mean by hash table?

978


Define ancestor and descendant ?

991


For addition and deletion. Which one is most preferred: array list or linked list?

844


Are hash tables ordered?

853


Can hashmap have same key?

827


List the data structures which are used in hierarchical data model.

889


do records fall under linear or non linear data structures?

1672


How to find 3rd element from end in a linked list in one pass?

826


What is the Difference between sax and dom parser?

994


Differentiate between compilers and interpreters.

874


What is meant by hashing?

797


How many types of sorting algorithms are there?

833


How to sequentially represent max-heap?

852