Write programs for Bubble Sort, Quick sort
Answer Posted / prashant gupta
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,t;
int a[7]={5,7,8,1,4,2,9}; // You can use any length
for(i=0;i<6;i++)
{
for(j=i+1;j<6;j++)
{
if(a[i]>a[j])
{
t = a[i];
a[i] = a[j];
a[j] = t;
}
}
printf("The Sorted Array is = %d",a[i]);
getch();
}
Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
What is Insertion sort, selection sort, bubble sort( basic differences among the functionality of the three sorts and not the exact algorithms)?
When will we get ArrayStoreException?
Which is best array or linked list?
What is difference between array and arraylist? When will you use array over arraylist?
How does quick sort work?
Differentiate between set and map.
How do you sort an array by value?
What is an externalizable interface?
What is sorting explain?
Does treeset allow duplicates?
Which is better bubble sort or selection sort?
You are given a singly linked list. How would you find out if it contains a loop or not without using temporary space?
What is application of data structure?
What do u mean by array?
What differences exist between hashmap and hashtable?