/* Selection Sort */
#include<stdio.h> int main() { int arr[10],i,j,k,t; printf("Please enter 10 values:\n"); for(i=0;i<10;i++) scanf("%d",&arr[i]); for(i=0;i<10;i++) { k=i; for(j=i;j<10;j++) { if(a[k]>a[j]) k=j; } if(k!=i) { t=a[k]; a[k]=a[i]; a[i]=t; } } printf("Sorted Array is:\n"); for(i=0;i<10;i++) printf("%d\n",arr[i]); return 0; }
Related Posts:
-------------------------------------------------------------
Bubble Sort
http://cbasicprogram.blogspot.in/2012/05/bubble-sort.html
Insertion Sort
http://cbasicprogram.blogspot.in/2012/05/insertion-sort.html
nice blog
ReplyDeletegreat
ReplyDeletenice article for beginners.thank you.
ReplyDeletewelookups C++
javacodegeeks
Nice article you can refer here :
ReplyDeleteselection sort
nice article
ReplyDeletehttps://www.sitesbay.com/cpp-datastructure/cpp-selection-sort
ReplyDeletetry this content really nice
Selection sort in c++
ReplyDelete