SlideShare a Scribd company logo
SELECTION SORT
SOUMEN SANTRA
MCA, M.Tech, SCJP, MCP
Selection Sort Ascending Order
15 10 13 14 16 12
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 16 12
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 16 12
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 16 12
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 16 12
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 16 12
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 16 12
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 16 12

Largest
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 12 16
MOVING &
SWAPPINGChecking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 12 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 12 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 12 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 12 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 12 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 12 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
15 10 13 14 12 16

Largest
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
MOVING &
SWAPPINGChecking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16

Largest
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
NO MOVING &
NO
SWAPPING
POSITION FIX
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted

Largest
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
NO MOVING &
NO
SWAPPING
POSITION FIX
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
Selection Sort Ascending Order
12 10 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted

Largest
Selection Sort Ascending Order
10 12 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
COMPARING &
SWAPPING
Selection Sort Ascending Order
10 12 13 14 15 16
Checking Largest one
Data Comparing & Swapping
Sorted
ALL SORTED!
ALGORITHM
Selection_Sort(Array, size of Array)
Begin
Do loop (size - 1) times
set the first unsorted element as the maximum
for each of the unsorted elements
if element > current_Maximum
set element as new maximum
swap maximum with first unsorted position
end
Implementation in C
#include <stdio.h>
void swap(int *a, int *b)
{ int temp = *a;
*a = *b;
*b = temp;
}
void Selection_Sort(int array[], int size_of_Array )
{
for (int step = 0; step < size_of_Array - 1; step++)
{
int max = step;
for (int i = step + 1; i < size_of_Array ; i++)
{
if (array[i] < array[min])
max = i;
}
swap(&array[max], &array[step]);
}
}
void display(int array[], int size_of_Array )
{
for (int i = 0; i < size_of_Array ; ++i)
{
printf("%d ", array[i]); } printf("n");
}
void main()
{
int data[] = {15, 10, 13, 14, 16, 12};
int size_of_Array = sizeof(data) / sizeof(data[0]);
Selection_Sort(data, size_of_Array );
printf("Sorted array in Acsending Order:n");
display(data, size_of_Array );
}
THANK YOU
GIVE FEEDBACK

More Related Content

PPT
Insertion sort : Sorting Analysis with Program and Algorithm
PPSX
PPT
Merge sort
PPSX
Stacks Implementation and Examples
PPTX
Data structure by Digvijay
PPTX
Analysis of Algorithm (Bubblesort and Quicksort)
PPSX
Data Structure (Queue)
PPTX
Quick sort
Insertion sort : Sorting Analysis with Program and Algorithm
Merge sort
Stacks Implementation and Examples
Data structure by Digvijay
Analysis of Algorithm (Bubblesort and Quicksort)
Data Structure (Queue)
Quick sort

What's hot (20)

PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
PPTX
Quick Sort
PPTX
Binary Tree in Data Structure
PPTX
PPTX
Insertion sort algorithm power point presentation
PPTX
Searching and sorting
PPTX
Data Structures - Lecture 8 [Sorting Algorithms]
PPT
Quick Sort
PPTX
Insertion sort
PPTX
Queue Implementation Using Array & Linked List
PPTX
Sorting algorithms
PPTX
Infix postfixcoversion
PPTX
Bubble Sort Algorithm Presentation
PPTX
Stacks IN DATA STRUCTURES
PPTX
Ppt bubble sort
PPTX
Insertion sort
PPTX
Stack and Queue by M.Gomathi Lecturer
PPT
Queue Data Structure
PPTX
Queue and its operations
PDF
Sorting Algorithms
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Quick Sort
Binary Tree in Data Structure
Insertion sort algorithm power point presentation
Searching and sorting
Data Structures - Lecture 8 [Sorting Algorithms]
Quick Sort
Insertion sort
Queue Implementation Using Array & Linked List
Sorting algorithms
Infix postfixcoversion
Bubble Sort Algorithm Presentation
Stacks IN DATA STRUCTURES
Ppt bubble sort
Insertion sort
Stack and Queue by M.Gomathi Lecturer
Queue Data Structure
Queue and its operations
Sorting Algorithms
Ad

Similar to Selection sort Mechanism and implementation (20)

PPTX
selection sort Notes with algorithm Complexity
PPT
3.4 selection sort
PPTX
Unit 7 sorting
PPT
SelectionSort.ppt
PPT
Selection Sort working that how it works
PPT
SelectionSort.ppt
PDF
Intersection Study - Algorithm(Sort)
PPT
Sorting algorithms
PPT
Data Structure (MC501)
PPT
Sorting algorithms v01
PPT
PPT
(Data Structure) Chapter11 searching & sorting
PPTX
2.Problem Solving Techniques and Data Structures.pptx
PPTX
Different types of Shoring Algorithms with Animation
PDF
21 elementarysorts 2
PDF
21 Elementary Sorts pdf sorting technique
PDF
Sorting
PDF
Sorting
PPT
Sorting algos
PPT
selection sort Notes with algorithm Complexity
3.4 selection sort
Unit 7 sorting
SelectionSort.ppt
Selection Sort working that how it works
SelectionSort.ppt
Intersection Study - Algorithm(Sort)
Sorting algorithms
Data Structure (MC501)
Sorting algorithms v01
(Data Structure) Chapter11 searching & sorting
2.Problem Solving Techniques and Data Structures.pptx
Different types of Shoring Algorithms with Animation
21 elementarysorts 2
21 Elementary Sorts pdf sorting technique
Sorting
Sorting
Sorting algos
Ad

More from Soumen Santra (20)

PDF
Basic and advance idea of Sed and Awk script with examples
PPT
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
PPTX
Cell hole identification in carcinogenic segment using Geodesic Methodology: ...
PPTX
PPT_PAPERID 31_SOUMEN_SANTRA - ICCET23.pptx
PPT
Basic networking hardware: Switch : Router : Hub : Bridge : Gateway : Bus : C...
DOC
Traveling salesman problem: Game Scheduling Problem Solution: Ant Colony Opti...
PPT
Optimization techniques: Ant Colony Optimization: Bee Colony Optimization: Tr...
PPTX
A Novel Real Time Home Automation System with Google Assistance Technology
PPTX
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
PPTX
Java Basic PART I
PPT
Threads Advance in System Administration with Linux
PPTX
Frequency Division Multiplexing Access (FDMA)
PPTX
Carrier Sense Multiple Access With Collision Detection (CSMA/CD) Details : Me...
PPTX
Code-Division Multiple Access (CDMA)
PPTX
PURE ALOHA : MEDIUM ACCESS CONTROL PROTOCOL (MAC): Definition : Types : Details
PPTX
Carrier-sense multiple access with collision avoidance CSMA/CA
PPTX
RFID (RADIO FREQUENCY IDENTIFICATION)
PPTX
SPACE DIVISION MULTIPLE ACCESS (SDMA) SATELLITE COMMUNICATION
PPT
Threads Basic : Features, Types & Implementation
PPT
CLOUD COMPUTING : BASIC CONCEPT REGARDING LOAD BALANCING AND Virtual Machine ...
Basic and advance idea of Sed and Awk script with examples
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Cell hole identification in carcinogenic segment using Geodesic Methodology: ...
PPT_PAPERID 31_SOUMEN_SANTRA - ICCET23.pptx
Basic networking hardware: Switch : Router : Hub : Bridge : Gateway : Bus : C...
Traveling salesman problem: Game Scheduling Problem Solution: Ant Colony Opti...
Optimization techniques: Ant Colony Optimization: Bee Colony Optimization: Tr...
A Novel Real Time Home Automation System with Google Assistance Technology
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Java Basic PART I
Threads Advance in System Administration with Linux
Frequency Division Multiplexing Access (FDMA)
Carrier Sense Multiple Access With Collision Detection (CSMA/CD) Details : Me...
Code-Division Multiple Access (CDMA)
PURE ALOHA : MEDIUM ACCESS CONTROL PROTOCOL (MAC): Definition : Types : Details
Carrier-sense multiple access with collision avoidance CSMA/CA
RFID (RADIO FREQUENCY IDENTIFICATION)
SPACE DIVISION MULTIPLE ACCESS (SDMA) SATELLITE COMMUNICATION
Threads Basic : Features, Types & Implementation
CLOUD COMPUTING : BASIC CONCEPT REGARDING LOAD BALANCING AND Virtual Machine ...

Recently uploaded (20)

PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Construction Project Organization Group 2.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Geodesy 1.pptx...............................................
PPTX
Welding lecture in detail for understanding
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Well-logging-methods_new................
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Foundation to blockchain - A guide to Blockchain Tech
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Embodied AI: Ushering in the Next Era of Intelligent Systems
Model Code of Practice - Construction Work - 21102022 .pdf
Lecture Notes Electrical Wiring System Components
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Construction Project Organization Group 2.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
additive manufacturing of ss316l using mig welding
Geodesy 1.pptx...............................................
Welding lecture in detail for understanding
CH1 Production IntroductoryConcepts.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
R24 SURVEYING LAB MANUAL for civil enggi
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Well-logging-methods_new................
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx

Selection sort Mechanism and implementation