SlideShare a Scribd company logo
SELECTION SORT
Vipin Ramola
PGT Comp. Sc.
KV Balasore
Bhubaneswar Region
1
2
OBJECTIVES
 To learn sorting
 To learn about Selection Sort – writing
program
 Application of Selection Sort
 Advantages & Disadvantages
3
PREVIOUS KNOWLEDGE
 Variables
 Loops
 Functions
4
Sorting
 Arranging elements/data/items in ascending
or descending order of values.
 Fundamental problems in computer science
and programming
 Sorting done to make searching easier
 Multiple different algorithms to solve the
same problem
5
Selection sort
 Algorithm
– Search through the list and find the smallest element
– swap the smallest element with the first element
– repeat starting at second element and find the second
smallest element and so on
Program
6
for(i=0; i< n-1; i++)
{
/* find the index of min element in the unsorted a[j ..
n-1] assume the min is the first element */
minIndex=i;
// test against elements after j to find the smallest
for(j=i+1; j< n; j++)
{
// if this element is less, then it is the new minimum
if(A[j] < A[minIndex])
minIndex = j;
}
/* iMin is the index of the minimum element. Swap it
with the current position */
if(minIndex!=i)
{
temp = A[i];
A[i]=A[minIndex];
A[minIndex] = temp;
}
}
7
ANIMATION
8
Applications of Selection Sort
 In embedded systems
 In basic mobiles
Advantages & Disadvantages
Advantages
Easy/simple implementation.
Useful when no. of elements are less.
Can be used when memory is less.
Disadvantages
It is slower when no of elements are more.
Performance varies with initial order of Input
9
Thank You
10

More Related Content

PPT
Selection sort
PPTX
Bubble Sort Algorithm Presentation
PPTX
Presentation on the topic selection sort
PPTX
Quick sort
PPTX
Searching
PPTX
Data Structures - Lecture 8 [Sorting Algorithms]
PPT
Insertion sort
PPTX
Selection sorting
Selection sort
Bubble Sort Algorithm Presentation
Presentation on the topic selection sort
Quick sort
Searching
Data Structures - Lecture 8 [Sorting Algorithms]
Insertion sort
Selection sorting

What's hot (20)

PPTX
sorting and its types
PPTX
Introduction to stack
PPTX
linked list in Data Structure, Simple and Easy Tutorial
PPT
Data Structures - Searching & sorting
PPTX
Insertion sort
PPTX
Selection sort
PPTX
Searching and sorting
PPTX
Bubble sort
PPTX
Linear and Binary search
PPTX
Binary Tree in Data Structure
PPTX
Searching techniques in Data Structure And Algorithm
PDF
Binary search tree operations
PDF
Sorting Algorithms
PPTX
Quick sort
PPTX
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
PPTX
Stacks IN DATA STRUCTURES
PPT
Algorithm: Quick-Sort
PPTX
Data Structures : hashing (1)
sorting and its types
Introduction to stack
linked list in Data Structure, Simple and Easy Tutorial
Data Structures - Searching & sorting
Insertion sort
Selection sort
Searching and sorting
Bubble sort
Linear and Binary search
Binary Tree in Data Structure
Searching techniques in Data Structure And Algorithm
Binary search tree operations
Sorting Algorithms
Quick sort
PPT On Sorting And Searching Concepts In Data Structure | In Programming Lang...
Stacks IN DATA STRUCTURES
Algorithm: Quick-Sort
Data Structures : hashing (1)
Ad

Similar to Selection Sort - Vipin Ramola (20)

PPT
SIMPLE SORTING MUKUND
PPTX
Sorting And Type of Sorting
PPT
Sorting algorithums > Data Structures & Algorithums
PPTX
Sorting Algorithms
PPT
simple-sorting algorithms
PPTX
Selection and insertion sort
PDF
Advanced Topics In Java Core Concepts In Data Structures Noel Kalicharan
PDF
Algorithms Analysis
PPT
Selection sort
PDF
Unit v data structure-converted
ODP
Sorting Algorithm
PPTX
Selection and insertion sort
PPTX
Lecture3a sorting
PDF
Sorting Algorithms: Bubble Sort, Selection Sort,
PPTX
Selection Sort & Insertion Sorts Algorithms
PPTX
SORTING techniques.pptx
PPTX
Selection sort and insertion sort
PPTX
Selection Sort and Insertion Sort
PDF
selection
PDF
selectionsortselectionsortselectionsortselectionsort
SIMPLE SORTING MUKUND
Sorting And Type of Sorting
Sorting algorithums > Data Structures & Algorithums
Sorting Algorithms
simple-sorting algorithms
Selection and insertion sort
Advanced Topics In Java Core Concepts In Data Structures Noel Kalicharan
Algorithms Analysis
Selection sort
Unit v data structure-converted
Sorting Algorithm
Selection and insertion sort
Lecture3a sorting
Sorting Algorithms: Bubble Sort, Selection Sort,
Selection Sort & Insertion Sorts Algorithms
SORTING techniques.pptx
Selection sort and insertion sort
Selection Sort and Insertion Sort
selection
selectionsortselectionsortselectionsortselectionsort
Ad

More from Dipayan Sarkar (18)

PPT
Relationships
PPTX
ideal learning space
PPTX
introduction to aep arc
PPTX
why focus on adolescents unique needs
PPT
aep in india milestones, learning, way forward
PDF
Softskills - S Fernandez
PDF
Project Based Learning- Ashish K Chaurdia
PDF
Linux and the Open Source- D Sarkar
PPT
File Handling - N K Upadhyay
PPTX
Sorting Techniques - Govardhan Satish
PPTX
Application of Stack - Yadraj Meena
PPT
Information Technology Act 2000 - Santosh K Pathak
PPTX
Universal Gates - Aneesa N Ali
PPT
Deletion of a Record from a File - K Karun
PPTX
Java Databse Connectvity- Alex Jose
PPTX
Computer Viruses- B S Kalyan Chakravarthy
PPT
Cloud Computing- Sreehari S
PPTX
SQL JOINS- Reena P V
Relationships
ideal learning space
introduction to aep arc
why focus on adolescents unique needs
aep in india milestones, learning, way forward
Softskills - S Fernandez
Project Based Learning- Ashish K Chaurdia
Linux and the Open Source- D Sarkar
File Handling - N K Upadhyay
Sorting Techniques - Govardhan Satish
Application of Stack - Yadraj Meena
Information Technology Act 2000 - Santosh K Pathak
Universal Gates - Aneesa N Ali
Deletion of a Record from a File - K Karun
Java Databse Connectvity- Alex Jose
Computer Viruses- B S Kalyan Chakravarthy
Cloud Computing- Sreehari S
SQL JOINS- Reena P V

Recently uploaded (20)

PPTX
Lesson notes of climatology university.
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
RMMM.pdf make it easy to upload and study
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
Complications of Minimal Access Surgery at WLH
Lesson notes of climatology university.
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Computing-Curriculum for Schools in Ghana
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Final Presentation General Medicine 03-08-2024.pptx
A systematic review of self-coping strategies used by university students to ...
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Final Presentation General Medicine 03-08-2024.pptx
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Supply Chain Operations Speaking Notes -ICLT Program
What if we spent less time fighting change, and more time building what’s rig...
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
RMMM.pdf make it easy to upload and study
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Complications of Minimal Access Surgery at WLH

Selection Sort - Vipin Ramola

  • 1. SELECTION SORT Vipin Ramola PGT Comp. Sc. KV Balasore Bhubaneswar Region 1
  • 2. 2 OBJECTIVES  To learn sorting  To learn about Selection Sort – writing program  Application of Selection Sort  Advantages & Disadvantages
  • 4. 4 Sorting  Arranging elements/data/items in ascending or descending order of values.  Fundamental problems in computer science and programming  Sorting done to make searching easier  Multiple different algorithms to solve the same problem
  • 5. 5 Selection sort  Algorithm – Search through the list and find the smallest element – swap the smallest element with the first element – repeat starting at second element and find the second smallest element and so on
  • 6. Program 6 for(i=0; i< n-1; i++) { /* find the index of min element in the unsorted a[j .. n-1] assume the min is the first element */ minIndex=i; // test against elements after j to find the smallest for(j=i+1; j< n; j++) { // if this element is less, then it is the new minimum if(A[j] < A[minIndex]) minIndex = j; } /* iMin is the index of the minimum element. Swap it with the current position */ if(minIndex!=i) { temp = A[i]; A[i]=A[minIndex]; A[minIndex] = temp; } }
  • 8. 8 Applications of Selection Sort  In embedded systems  In basic mobiles
  • 9. Advantages & Disadvantages Advantages Easy/simple implementation. Useful when no. of elements are less. Can be used when memory is less. Disadvantages It is slower when no of elements are more. Performance varies with initial order of Input 9