## Posts

Showing posts from May 18, 2014

### Bubble sort

Term Project
Choose a problem from the topics below or other topics and design two different algorithms for this problem. For each algorithm, write a parallel program. Students will be asked to present their problem description, algorithm(s) employed, program description, and performance plots to the class using 5-10 minutes.

Submit the following: A 3-5 page single-spaced project report (hard copy) containing the following sections:
1.Problem: Bubble Sort

2.chosen algorithms
BUBBLE SORT
·procedure bubbleSort( A : list of sortable items ) n = length(A)
for i = 1 to  n-1 inclusive do
for j=1to n-2 inclusive do
if A[j] > A[j+1] then swap( A[i-1], A[i] )
end if end for end for
end procedure
#include<stdio.h>
#include<conio.h>
void main()
{
long int i,j,tmp,a;
for(i=0;i<n;i++)
printf("enter nos.\n");

for(i=0;i<10;i++)
scanf("%ld",&a[i]);

for(i=0;i<10;i++)
{
for(j=0;j<9;j++)
if(a[j]>a[j+1])
{
tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
}
printf("sorted array is -->\n…