SlideShare a Scribd company logo
1 of 29
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

What's hot

PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...Umesh Kumar
 
Quick sort data structures
Quick sort data structuresQuick sort data structures
Quick sort data structureschauhankapil
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search treeKrish_ver2
 
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary searchZia Ush Shamszaman
 
Different Sorting tecniques in Data Structure
Different Sorting tecniques in Data StructureDifferent Sorting tecniques in Data Structure
Different Sorting tecniques in Data StructureTushar Gonawala
 
Binary search tree operations
Binary search tree operationsBinary search tree operations
Binary search tree operationsKamran Zafar
 
Bubble sort
Bubble sortBubble sort
Bubble sortManek Ar
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsMohamed Loey
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting AlgorithmsRahul Jamwal
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy TutorialAfzal Badshah
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structureschauhankapil
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Treesagar yadav
 

What's hot (20)

Selection sorting
Selection sortingSelection sorting
Selection sorting
 
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
 
Quick sort data structures
Quick sort data structuresQuick sort data structures
Quick sort data structures
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search tree
 
Selection sort algorithm presentation, selection sort example using power point
Selection sort algorithm presentation, selection sort example using power point Selection sort algorithm presentation, selection sort example using power point
Selection sort algorithm presentation, selection sort example using power point
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary search
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
 
Quick Sort
Quick SortQuick Sort
Quick Sort
 
Quick sort
Quick sortQuick sort
Quick sort
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Different Sorting tecniques in Data Structure
Different Sorting tecniques in Data StructureDifferent Sorting tecniques in Data Structure
Different Sorting tecniques in Data Structure
 
Binary search tree operations
Binary search tree operationsBinary search tree operations
Binary search tree operations
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
Algorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching AlgorithmsAlgorithms Lecture 6: Searching Algorithms
Algorithms Lecture 6: Searching Algorithms
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structures
 
Merge sort algorithm power point presentation
Merge sort algorithm power point presentationMerge sort algorithm power point presentation
Merge sort algorithm power point presentation
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 

Viewers also liked

Viewers also liked (20)

Selection sort
Selection sortSelection sort
Selection sort
 
Selection sort
Selection sortSelection sort
Selection sort
 
3.4 selection sort
3.4 selection sort3.4 selection sort
3.4 selection sort
 
The selection sort algorithm
The selection sort algorithmThe selection sort algorithm
The selection sort algorithm
 
Bubble Sort
Bubble SortBubble Sort
Bubble Sort
 
Quick sort
Quick sortQuick sort
Quick sort
 
Sorting (Bubble,Merge,Selection sort)
Sorting (Bubble,Merge,Selection sort)Sorting (Bubble,Merge,Selection sort)
Sorting (Bubble,Merge,Selection sort)
 
Insertion Sort
Insertion SortInsertion Sort
Insertion Sort
 
Divide and conquer - Quick sort
Divide and conquer - Quick sortDivide and conquer - Quick sort
Divide and conquer - Quick sort
 
Sorting
SortingSorting
Sorting
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Algorithm: Quick-Sort
Algorithm: Quick-SortAlgorithm: Quick-Sort
Algorithm: Quick-Sort
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Quick Sort
Quick SortQuick Sort
Quick Sort
 
Triangular numbers
Triangular numbersTriangular numbers
Triangular numbers
 
Sorting
SortingSorting
Sorting
 
Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin Ramola
 
sort search in C
 sort search in C  sort search in C
sort search in C
 
Linear and Bianry search
Linear and Bianry searchLinear and Bianry search
Linear and Bianry search
 
Selection Sort
Selection SortSelection Sort
Selection Sort
 

Similar to Selection sort

Selection and insertion sort
Selection and insertion sortSelection and insertion sort
Selection and insertion sortAnn Tugade
 
Sorting method data structure
Sorting method data structureSorting method data structure
Sorting method data structuresunilchute1
 
sorting and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptxParagAhir1
 
Selection and insertion sort
Selection and insertion sortSelection and insertion sort
Selection and insertion sortAnn Tugade
 
Selection-sort-in-algorithm and complexity.pptx
Selection-sort-in-algorithm and complexity.pptxSelection-sort-in-algorithm and complexity.pptx
Selection-sort-in-algorithm and complexity.pptxArjayBalberan1
 
Sorting and Its Types
Sorting and Its TypesSorting and Its Types
Sorting and Its Typesamberkhan59
 
366 it elective 4 (analysis of algoritm)
366 it elective 4 (analysis of algoritm)366 it elective 4 (analysis of algoritm)
366 it elective 4 (analysis of algoritm)Neil Soliven
 
Data structure using c module 3
Data structure using c module 3Data structure using c module 3
Data structure using c module 3smruti sarangi
 
DS PPT - ( 1 )SORTING lgoritham techniques with bast example
DS PPT - ( 1 )SORTING lgoritham techniques with bast exampleDS PPT - ( 1 )SORTING lgoritham techniques with bast example
DS PPT - ( 1 )SORTING lgoritham techniques with bast exampleVivek487417
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptxSajalFayyaz
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
Selection Sort and Insertion Sort
Selection Sort and Insertion SortSelection Sort and Insertion Sort
Selection Sort and Insertion Sorttamayaoraquel
 
Selection sort and insertion sort
Selection sort and insertion sortSelection sort and insertion sort
Selection sort and insertion sortMay Ann Mendoza
 
Different types of Shoring Algorithms with Animation
Different types of Shoring Algorithms with AnimationDifferent types of Shoring Algorithms with Animation
Different types of Shoring Algorithms with AnimationZakaria Hossain
 
Unit III Version I.pptx
Unit III Version I.pptxUnit III Version I.pptx
Unit III Version I.pptxssuserd602fd
 

Similar to Selection sort (20)

Selection and insertion sort
Selection and insertion sortSelection and insertion sort
Selection and insertion sort
 
Steffy
SteffySteffy
Steffy
 
Sorting method data structure
Sorting method data structureSorting method data structure
Sorting method data structure
 
sorting and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptx
 
Selection and insertion sort
Selection and insertion sortSelection and insertion sort
Selection and insertion sort
 
Selection-sort-in-algorithm and complexity.pptx
Selection-sort-in-algorithm and complexity.pptxSelection-sort-in-algorithm and complexity.pptx
Selection-sort-in-algorithm and complexity.pptx
 
Sorting Algorithms.pptx
Sorting Algorithms.pptxSorting Algorithms.pptx
Sorting Algorithms.pptx
 
Sorting and Its Types
Sorting and Its TypesSorting and Its Types
Sorting and Its Types
 
366 it elective 4 (analysis of algoritm)
366 it elective 4 (analysis of algoritm)366 it elective 4 (analysis of algoritm)
366 it elective 4 (analysis of algoritm)
 
Chapter-2.pptx
Chapter-2.pptxChapter-2.pptx
Chapter-2.pptx
 
Data structure using c module 3
Data structure using c module 3Data structure using c module 3
Data structure using c module 3
 
DS PPT - ( 1 )SORTING lgoritham techniques with bast example
DS PPT - ( 1 )SORTING lgoritham techniques with bast exampleDS PPT - ( 1 )SORTING lgoritham techniques with bast example
DS PPT - ( 1 )SORTING lgoritham techniques with bast example
 
Sorting
SortingSorting
Sorting
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
 
SIMPLE SORTING MUKUND
SIMPLE SORTING MUKUNDSIMPLE SORTING MUKUND
SIMPLE SORTING MUKUND
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Selection Sort and Insertion Sort
Selection Sort and Insertion SortSelection Sort and Insertion Sort
Selection Sort and Insertion Sort
 
Selection sort and insertion sort
Selection sort and insertion sortSelection sort and insertion sort
Selection sort and insertion sort
 
Different types of Shoring Algorithms with Animation
Different types of Shoring Algorithms with AnimationDifferent types of Shoring Algorithms with Animation
Different types of Shoring Algorithms with Animation
 
Unit III Version I.pptx
Unit III Version I.pptxUnit III Version I.pptx
Unit III Version I.pptx
 

Recently uploaded

A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfsmsksolar
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 

Recently uploaded (20)

A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdf
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 

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