Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
ADA Final Submission (ADA Programs)

ADA Final Submission (ADA Programs)

Ratings: (0)|Views: 140|Likes:
Published by TB

More info:

Published by: TB on May 22, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

01/12/2013

pdf

text

original

 
Name: Tanmay BaidRollNumber: 0829cs071112
Bubble Sort
# include<stdio.h># include<conio.h>void main(){int a[5], i, j, temp;clrscr();printf("Enter 5 elements of array: ");for(i=0;i<5;i++){scanf("%d",&a[i]);}for(i=0;i<5;i++){for(j=0;j<4;j++){if(a[j]>a[j+1]){temp=a[j];a[j]=a[j+1];a[j+1]=temp;}}}printf("Sorted array: ");for(i=0;i<5;i++){printf("\n%d",a[i]);}getch();}
1
 
Name: Tanmay BaidRollNumber: 0829cs071112Output
Enter 5 elements of array: 1 8 5 2 7Sorted array:12578
2
 
Name: Tanmay BaidRollNumber: 0829cs071112
Merge Sort
#include<stdio.h>#include<conio.h>void mergesort(int x[],int n){int aux[10],i,j,k,l1,u1,l2,u2,size;size=1;while(size<n){l1=0;k=0;while(l1+size<n){l2=l1+size;u1=l2-1;if(l2+size-1<n)u2=l2+size-1;elseu2=n-1;for(i=l1,j=l2;i<=u1 && j<=u2;k++){if(x[i]<x[j])aux[k]=x[i++];elseaux[k]=x[j++];}for(;i<=u1;k++)aux[k]=x[i++];for(;j<=u2;k++)aux[k]=x[j++];l1=u2+1;}
3

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->