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

Which sorting algorithm is considered the fastest?

766


Differentiate between an array and an arraylist.

768


What is the space complexity of quicksort?

659


What is data structure and its operations?

628


Design a datastructure to represent the movement of a knight on a chess board

719


Tell me about the different sorting techniques.

704


Which collection is used for sort?

666


Write a data structure for a queue.

806


Which language is best for learning data structures and algorithms?

691


Are duplicates allowed in list?

659


Can you please explain the difference between array_name and &array_name?

739


What are the average and worst time complexity in a sorted binary tree is

735


How do you declare An array of three char pointers

663


What is numeric array?

591


What is reduction to sorting method?

684