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
Mention a few applications of linked lists?
Parenthesis is never required in postfix or prefix expressions, why?
What do you mean by hash table?
Define ancestor and descendant ?
For addition and deletion. Which one is most preferred: array list or linked list?
Are hash tables ordered?
Can hashmap have same key?
List the data structures which are used in hierarchical data model.
do records fall under linear or non linear data structures?
How to find 3rd element from end in a linked list in one pass?
What is the Difference between sax and dom parser?
Differentiate between compilers and interpreters.
What is meant by hashing?
How many types of sorting algorithms are there?
How to sequentially represent max-heap?