Program 9 Seletion Sort
Program 9 Seletion Sort
Design and implement C program to sort a given set of n integer elements using Selection
Sort method and compute its time complexity.Run the program for varied values of n>5000
and record the time taken to sort .Plot a graph of the time taken versus n.The elements can
be read from a file or can be generated using random number generator.
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
int i,j;
int min = i;
min = j;
array[min] = array[i];
array[i] = temp;
int main()
int n, a[50000],k;
clock_t st,et;
double ts;
printf("\n Enter How many Numbers: ");
scanf("%d", &n);
a[k]=rand();
printf("%d\t",a[k]);
st=clock();
SelectionSort(a,n);
et=clock();
ts=(double)(et-st)/CLOCKS_PER_SEC;
printf("%d\t", a[k]);