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

What is time complexity of bubble sort?

472


How much time does it take to learn data structures?

522


What is the difference between array and stack?

549


What are linked lists used for?

541


How long does it take to master data structures and algorithms?

675






What is a height of a tree?

494


What is the difference between hashset and hashmap?

547


Define leaves?

586


Is arraylist a class?

474


Is binary tree a binary search tree?

489


What are b tree keys?

466


What is stable sort?

526


What is data in computer science?

521


Why is arraylist not thread safe?

519


Differentiate between arraylist and vector.

867