Posts

Showing posts from March, 2013

Data Structures : Programs

1.Program for Sorting ‘n’ elements Using bubble sort technique. #include "stdio.h" #include "conio.h" void main() { int a[10],i,j,n,temp; clrscr(); printf("Enter no. of Elements:"); scanf("%d",&n); printf("Enter Values:\n"); for(i=0;i=0;i--) for(j=0;j a[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } printf("After sorting elements are:\n"); for(i=0;i<n;i++) printf("%d\t",a[i]); getch(); } Output Enter no. of Elements:5 Enter Values: 10 55 16 89 24 After sorting elements are: 10 16 24 55 89 2.Sort given elements using Selection Sort. #include "stdio.h" #include "conio.h" void main( ) { in...