SlideShare a Scribd company logo
DONE BY:
D.STELLA
CSE B SECTION
140071601073
B.S.ABDUR RAHMAN UNIVERSITY
VANDALORE,CHENNAI.
SELECTION SORT
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.
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.
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
86 32 961951 23
Selecting the smaller
86 32 961951 23
Selecting the smaller
86 32 961951 23
Selecting the smaller
86 32 961951 23
Selecting the smaller
86 32 961951 23
Selecting the smaller
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
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
Selecting the smaller
Selecting the smaller
Selecting the smaller
Selecting the smaller
19 32 968651 23
Now,from the unsorted list ,the smallest element is
23. so replace it by same manner.
19 32 968651 23
19 23 51 86 32 96
Now the list becomes changed.
The list is divided in to sorted and unsorted list.
Pass 2
19 23 968651 32
Selecting the smaller
19 23 968651 32
Selecting the smaller
19 23 968651 32
Selecting the smaller
19 23 968651 32
smaller
Now,the list is rearranged.
19 23 86 51 9632
Pass 3
19 23 968632 51
Selecting the smaller
19 23 968632 51
Selecting the smaller
19 23 968632 51
smaller
Selecting the smaller
19 23 965132 86
Selecting the smaller
19 23 965132 86
While checking the remaining elements,they
are automatically arranged in order.
19 23 965132 86
Pass 4
19 23 965132 86
SORTED LIST
PSEUDO CODE FOR SELECTION SORT
for(i=0;i<n-1;i++)
{
min=i;
For(j=i+1;j<n;j++)
If(a[j]<a[min})
Min=j;
Swap(a[i},a[min}
}
}
Pass 5
Selection sort

More Related Content

PPTX
Selection sorting
PPTX
Operating system presentation
PPTX
Selection sort
PPTX
Presentation on the topic selection sort
PPTX
Insertion Sorting
PPTX
Congestion on computer network
PPTX
Merge sort algorithm power point presentation
PDF
8086 memory segmentation
Selection sorting
Operating system presentation
Selection sort
Presentation on the topic selection sort
Insertion Sorting
Congestion on computer network
Merge sort algorithm power point presentation
8086 memory segmentation

What's hot (20)

PPTX
Selection sort
PPTX
Linked list
PPTX
Quick sort
PPTX
Searching and sorting
PDF
Binary Search - Design & Analysis of Algorithms
PPTX
Quick sort
PDF
Algorithms Lecture 2: Analysis of Algorithms I
PPTX
Quick sort
PPTX
Quick sort-Data Structure
PDF
Algorithms Lecture 6: Searching Algorithms
PPT
Quick Sort
PPTX
Priority Queue in Data Structure
PPT
Binary search tree(bst)
PPTX
PDF
Quick sort algorithn
PPTX
Linked List
PPT
Queue data structure
PPT
Bubble sort
PPTX
Data Structures - Lecture 8 [Sorting Algorithms]
PDF
linear search and binary search
Selection sort
Linked list
Quick sort
Searching and sorting
Binary Search - Design & Analysis of Algorithms
Quick sort
Algorithms Lecture 2: Analysis of Algorithms I
Quick sort
Quick sort-Data Structure
Algorithms Lecture 6: Searching Algorithms
Quick Sort
Priority Queue in Data Structure
Binary search tree(bst)
Quick sort algorithn
Linked List
Queue data structure
Bubble sort
Data Structures - Lecture 8 [Sorting Algorithms]
linear search and binary search
Ad

Viewers also liked (20)

DOC
Selection sort
PPT
3.4 selection sort
PPTX
The selection sort algorithm
PPTX
Bubble Sort
PPT
Selection sort
PPTX
Selection sort 1
PPTX
Sorting (Bubble,Merge,Selection sort)
PPTX
Insertion Sort
PPTX
Divide and conquer - Quick sort
PPT
Sorting
PPTX
Insertion sort
PPT
Algorithm: Quick-Sort
PPT
Sorting Algorithms
PPT
Triangular numbers
PPTX
Sorting
PPT
Selection Sort - Vipin Ramola
PDF
sort search in C
PPT
Linear and Bianry search
PDF
Selection Sort
PPT
Bubble sort
Selection sort
3.4 selection sort
The selection sort algorithm
Bubble Sort
Selection sort
Selection sort 1
Sorting (Bubble,Merge,Selection sort)
Insertion Sort
Divide and conquer - Quick sort
Sorting
Insertion sort
Algorithm: Quick-Sort
Sorting Algorithms
Triangular numbers
Sorting
Selection Sort - Vipin Ramola
sort search in C
Linear and Bianry search
Selection Sort
Bubble sort
Ad

Similar to Selection sort (20)

PPTX
Selection and insertion sort
PPT
Steffy
PPTX
AJisthewewrtyuiojhghfdfsgvhjhklopi87ytrytfghjk
PPTX
Sorting method data structure
PPTX
sorting and searching.pptx
PPTX
Selection and insertion sort
PPTX
Selection-sort-in-algorithm and complexity.pptx
PPTX
Sorting Algorithms.pptx
PPTX
Sorting and Its Types
PPTX
366 it elective 4 (analysis of algoritm)
PPTX
Chapter-2.pptx
PPTX
Data structure using c module 3
PPTX
DS PPT - ( 1 )SORTING lgoritham techniques with bast example
PPTX
sortting 2 sderftgyurvtynurftgyhujse.pptx
PPTX
Sorting
PPTX
Data structure.pptx
PPTX
Searching and Sorting algorithms and working
PDF
Sorting algorithms bubble sort to merge sort.pdf
PPT
SIMPLE SORTING MUKUND
PPTX
data structures and applications power p
Selection and insertion sort
Steffy
AJisthewewrtyuiojhghfdfsgvhjhklopi87ytrytfghjk
Sorting method data structure
sorting and searching.pptx
Selection and insertion sort
Selection-sort-in-algorithm and complexity.pptx
Sorting Algorithms.pptx
Sorting and Its Types
366 it elective 4 (analysis of algoritm)
Chapter-2.pptx
Data structure using c module 3
DS PPT - ( 1 )SORTING lgoritham techniques with bast example
sortting 2 sderftgyurvtynurftgyhujse.pptx
Sorting
Data structure.pptx
Searching and Sorting algorithms and working
Sorting algorithms bubble sort to merge sort.pdf
SIMPLE SORTING MUKUND
data structures and applications power p

Recently uploaded (20)

DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
additive manufacturing of ss316l using mig welding
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
737-MAX_SRG.pdf student reference guides
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Artificial Intelligence
PPTX
UNIT 4 Total Quality Management .pptx
PPT
Project quality management in manufacturing
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPTX
Current and future trends in Computer Vision.pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
Mechanical Engineering MATERIALS Selection
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
additive manufacturing of ss316l using mig welding
Categorization of Factors Affecting Classification Algorithms Selection
737-MAX_SRG.pdf student reference guides
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
R24 SURVEYING LAB MANUAL for civil enggi
Artificial Intelligence
UNIT 4 Total Quality Management .pptx
Project quality management in manufacturing
UNIT-1 - COAL BASED THERMAL POWER PLANTS
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
Current and future trends in Computer Vision.pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Safety Seminar civil to be ensured for safe working.
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
CYBER-CRIMES AND SECURITY A guide to understanding
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Mechanical Engineering MATERIALS Selection

Selection sort

  • 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
  • 5. 86 32 961951 23 Selecting the smaller
  • 6. 86 32 961951 23 Selecting the smaller
  • 7. 86 32 961951 23 Selecting the smaller
  • 8. 86 32 961951 23 Selecting the smaller
  • 9. 86 32 961951 23 Selecting the smaller
  • 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
  • 16. 19 32 968651 23 Now,from the unsorted list ,the smallest element is 23. so replace it by same manner.
  • 17. 19 32 968651 23 19 23 51 86 32 96 Now the list becomes changed. The list is divided in to sorted and unsorted list. Pass 2
  • 18. 19 23 968651 32 Selecting the smaller
  • 19. 19 23 968651 32 Selecting the smaller
  • 20. 19 23 968651 32 Selecting the smaller
  • 21. 19 23 968651 32 smaller Now,the list is rearranged. 19 23 86 51 9632 Pass 3
  • 22. 19 23 968632 51 Selecting the smaller
  • 23. 19 23 968632 51 Selecting the smaller
  • 24. 19 23 968632 51 smaller Selecting the smaller
  • 25. 19 23 965132 86 Selecting the smaller
  • 26. 19 23 965132 86 While checking the remaining elements,they are automatically arranged in order.
  • 27. 19 23 965132 86 Pass 4
  • 28. 19 23 965132 86 SORTED LIST PSEUDO CODE FOR SELECTION SORT for(i=0;i<n-1;i++) { min=i; For(j=i+1;j<n;j++) If(a[j]<a[min}) Min=j; Swap(a[i},a[min} } } Pass 5