13

Click here to load reader

Presentation on the topic selection sort

Embed Size (px)

Citation preview

Page 1: Presentation on the topic selection sort

Presentation on the topic Selection Sort

Presented By Saddam Hussain

Ravi Kr SinghRashan Pradhan

Raju Shah

Page 2: Presentation on the topic selection sort

Contents

Definition of Selection sort

Example

Algorithm with an Example

Advantage and disadvantages

conclusion

Page 3: Presentation on the topic selection sort

SELECTION SORT

In computer science,selection sort is a sortingalgorithm, specifically and inplace comparison sort. It has0(n2 time complexity.Selection sort is noted for itssimplicity and it hasperformance advantages.

Page 4: Presentation on the topic selection sort

HOW IT WORKS

The algorithm proceed by finding thesmallest (or largest depending onsorting order) element in the unsortedsublist , exchanging (swapping) it withthe left most unsorted element (puttingit in sorted order and have the sublistboundaries one element to the right.

Page 5: Presentation on the topic selection sort

FOR EXAMPLE

23 78 45 8 32 56 1

Page 6: Presentation on the topic selection sort

23 42 4 16 8 15

Current min=23

Page 7: Presentation on the topic selection sort

Algorithm

Step 1 − Set MIN to location 0

Step 2 − Search the minimum element in the list

Step 3 − Swap with value at location MIN

Step 4 − Increment MIN to point to next element

Step 5 − Repeat until list is sorted

Page 8: Presentation on the topic selection sort

for i=1 to n-1

min=I

for j=1+1 TO N

if array[j] < array[min]

min = j

if min != i

swap array[min] and array[i]

Page 9: Presentation on the topic selection sort
Page 10: Presentation on the topic selection sort

Advantages

The main advantage of the selection sort is that it performs well on a small list.

Because it is an in-place sorting algorithm, no additional temporary storage is required beyond what is needed to hold the original list.

Its performance is easily influenced by the initial ordering of the items before the sorting process.

Page 11: Presentation on the topic selection sort

Disadvantages

The primary disadvantage of the selection sort is its poor efficiency when dealing with a huge list of items.

The selection sort requires n-squared number of steps for sorting n elements.

Page 12: Presentation on the topic selection sort

References

www.tutorialpoints.com/selection_sort

www.wikipedia.com/selection_sort

www.google.com

Page 13: Presentation on the topic selection sort

Thank You