AOA Experiment 1
AOA Experiment 1
1
To implement Selection Sort
Date of Performance: 07/01/2025
Date of Submission: 22/01/2025
Experiment No. 1
The algorithm divides the input list into two parts: the sub list of items already sorted,
which is built up from left to right at the front (left) of the list, and the sub list of items
remaining to be sorted that occupy the rest of the list. Initially, the sorted sub list is empty
and the unsorted sub list is the entire input list. The algorithm proceeds by finding the
smallest (or largest, depending on sorting order) element in the unsorted sub list,
exchanging it with the leftmost unsorted element (putting it in sorted order), and moving
the sub-list boundaries one elementto the right.
Example:
Sort the given array using selection sort. arr[] = 64 25 12 22 11
#include <stdio.h>
int main() {
int n;
printf("Enter the size of the array: ");
Conclusion:
The Selection Sort algorithm is a simple and effective sorting technique that works well for
small datasets. It systematically selects the smallest element from the unsorted list and places
it in its correct position, gradually building a sorted sequence. Though its time complexity is
O(n²), making it inefficient for large datasets, it is advantageous when memory usage is a
concern since it operates in-place with O(1) auxiliary space. Despite its limitations, Selection
Sort serves as a fundamental algorithm for understanding sorting techniques and algorithm
analysis.