Program 9
Program 9
Design and implement C/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 the random number generator.
PROGRAM:
#include<stdio.h>
#include<time.h>
int main()
{
int a[10], i, n;
struct timespec start, end;
double dura;
clock_gettime(CLOCK_MONOTONIC, &start);
selsort(a, n);
clock_gettime(CLOCK_MONOTONIC, &end);
return 0;
}
OUTPUT: