Selection Sort_csv With Graph
Selection Sort_csv With Graph
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// Swap
temp = arr[minIdx];
arr[minIdx] = arr[i];
arr[i] = temp;
}
}
int main()
{
int arr[MAX_SIZE];
int n;
fprintf(fp, "n,time(ms)\n");
{
// Generate random array
for (int i = 0; i < n; i++)
{
arr[i] = rand() % 100000;
}
selectionSort(arr, n);
fclose(fp);
-3-
C:\Users\jayap\Desktop\2025-2025-Even Semester\BCS401-Analysis and Design of Algorithms\404 Lab Programs\9 Prg\SelectionSort_CSV.c Friday, 18 April, 2025 01:09 PM
/* OUTPUT
time_complexity_data.csv
n time(ms)
5000 25
10000 97
15000 222
20000 385
25000 623
30000 910
35000 1196
40000 1572
45000 1912
50000 2389
*/
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv('C:/Users/jayap/Desktop/2025-2025-Even
Semester/BCS401-Analysis and Design of Algorithms/404 Lab Programs/9
Prg/time_complexity_data.csv')
-4-
C:\Users\jayap\Desktop\2025-2025-Even Semester\BCS401-Analysis and Design of Algorithms\404 Lab Programs\9 Prg\SelectionSort_CSV.c Friday, 18 April, 2025 01:09 PM
-5-