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 subtree?
Is hashset a collection?
What sort does arrays sort use?
What is the minimization factor and time complexity of b-tree?
What are the goals of data structure?
What is the top of a stack?
What do you mean by collision in hashing?
Define probing?
If you have to store one lakh objects, what will be a better option- a hash map or an array list?
an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].
Why do we use insertion sort?
What is the capacity of arraylist?
What data structure does a binary tree degenerate?
How does sort function work?
Is array size dynamic or fixed?