Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Transcript of Selection Sort
Lubna Maqbool Khawaja
2014 May 11
What is Selection Sort ?
Selection sort is a very simple sorting algorithm which is very useful for sorting a small amount of data.
This type of sorting is called "Selection Sort" because it works by repeatedly element.
For i = 0 to n - 2
temp = a [ i ]
loc = i
for j = i + 1 to n - 1
if a [ j ] < a [ loc ]
loc = j
a [ i ] = a [ loc ]
a [ loc ] = temp
It is very easy to understand and learn.
It is still one of the slower methods
HOW A SELECTION SORT WORKS ?
1- find the smallest element
in the list.
2- Exchange the element in
the first position and
the smallest element.
3- Repeat step 1 and 2 with the
list having one less element
SELECTION SORT PROGRAM
Comparison to other