1. DONE BY:
D.STELLA
CSE B SECTION
140071601073
B.S.ABDUR RAHMAN UNIVERSITY
VANDALORE,CHENNAI.
SELECTION SORT
2. SELECTION SORT
selection sort is a sorting algorithm,
specifically an in-place comparison sort.
It has O(n2
) time complexity, making it
inefficient on large lists, and generally
performs worse than the similar
insertion sort.
3. ALGORITHM FOR SELECTION SORT
The list is divided in to two sublist ,sorted and
unsorted by an imajinary wall.
We find a smallest element from the unsorted sublist
and swap it with the element at the beginning of
unsorted data.
After each selection and swapping in the imajinary
wall between sublist move one element ahead,
increasingly the number of sorted elements and
decreases the number of unsorted one.
The process of moving one element from the
unsorted list to sorted list is called a pass.
A list of n elements requires n-1 passes to complete
the sorting.
4. 86 32 961951 23
This is unsorted list. Lets find the smallest
element from the unsorted list.
Then swap the element with the element at
the beginning of the unsorted list.
Lets find the smaller number
10. 86 32 961951 23
From this sorted list, the smallest element is 19.
According to the algorithm,the smallest number is
replaced in the beginning of the unsorted list.
This is first pass. Pass is defined as the the
process of moving one element from the unsorted
list to the sorted list.
Pass 1
11. 19 32 968651 23
Now,the list is divided in to two sublist
sorted and unsorted list
Then,find the smallest element in the unsorted list.
once again follow the same procedure.
sorted unsorted