0% found this document useful (0 votes)
4 views2 pages

AOA Experiment 1

The document outlines a programming assignment by Vivek Vishwakarma, focusing on implementing the selection sort algorithm. It includes the code for sorting an array of integers and demonstrates both the unsorted and sorted output. The performance date is set for January 27, 2025, with a submission date of February 3, 2025.

Uploaded by

vv376012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

AOA Experiment 1

The document outlines a programming assignment by Vivek Vishwakarma, focusing on implementing the selection sort algorithm. It includes the code for sorting an array of integers and demonstrates both the unsorted and sorted output. The performance date is set for January 27, 2025, with a submission date of February 3, 2025.

Uploaded by

vv376012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Performance Date: 27/01/2025 Submission Date:-03/02/2025

Name: Vivek Vishwakarma

Sr. No Experiment Name

1 Write a program to implement selection sort.

Code:
#include <stdio.h>
int main() {
int arr[]={77, 11, 44, 66 , 33, 22};
int n = 6;
int i, j, temp, min;
printf("unsorted array: ");
for(i=0; i<n; i++){
printf("%d ", arr[i]);
}
printf("\n");
for(i = 0; i < n-1; i++){
min = i;
for(j = i+1 ; j < n; j++){
if(arr[j]< arr[min]){
min = j;
}
}
if(min != i){
temp = arr[min];
arr[min] = arr[i];
arr[i] = temp;
}
}
printf("sorted array: ");
for(i=0; i<n; i++){
printf("%d ", arr[i]);
}
}

Output:

You might also like