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


Please Help Members By Posting Answers For Below Questions

Can a stack be described as a pointer? Explain.

457


How do you declare A pointer to array of three chars

531


What is the use of placement new?

590


When will you use array over arraylist?

529


Calculate the address of a random element present in a 2d array, given base address as ba.

1074






Why arraylist is not efficient for manipulation?

449


What do you mean by balanced trees?

543


What is a treeset?

485


What is heap tree explain with example?

504


Does arraylist maintain order?

512


Is list an array?

444


What is a map programming?

486


Traverse the given tree using Inorder, Preorder and Postorder traversals. Inorder : D H B E A F C I G J Preorder: A B D H E C F G I J Postorder: H D E B F I J G C A

653


Which sort is stable?

543


Write a program for Sorting an Array. Which sorting will you prefer?

593