Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
18Activity
0 of .
Results for:
No results containing your search query
P. 1
DS Final Submission (DS Programs)

DS Final Submission (DS Programs)

Ratings: (0)|Views: 1,106|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

12/03/2012

pdf

text

original

 
Selection 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=i;j<4;j++){if(a[i]>a[j+1]){temp=a[i];a[i]=a[j+1];a[j+1]=temp;}}}printf("Sorted Array is: ");for(i=0;i<5;i++){printf("\n%d",a[i]);}getch();}
 
Output
Enter 5 elements of Array: 2 5 7 3 8Sorted Array is:23578
 
Linear Search
# include<stdio.h># include<conio.h>void main(){int a[5],sno,i,f=0;clrscr();printf("Enter 5 element in Array: ");for(i=0;i<5;i++){scanf("%d",&a[i]);}printf("Enter element to be searched: ");scanf("%d",&sno);for(i=0;i<5;i++){if(sno==a[i]){printf("Number is found at %d position",i);f=1;}}if(f==0){printf("Number is not found");}getch();}

Activity (18)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Armin Suljovic liked this
Shabber Shaik liked this
adddata liked this
adddata liked this
Catherine Jones liked this
pradeep_8055 liked this
Zala Ramdevsinh liked this
Zala Ramdevsinh liked this

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)//-->