SlideShare a Scribd company logo
2
Most read
6
Most read
7
Most read
SELECTION SORT
1
Submitted by:
1 Arifarina
2 sakil
3 sabuj sarkar
4 Himu
Submitted to:
Mr.Tahzibul Islam
Lecturer,Department of
cse.Dhaka International
University.
2
DATA STRUCTURES-CSE 205
PRESENTATION
ROAD MAP
1 Definition
2 Example
3 Algorithm
4 Ascending And Dscending order.
6 Mathematical definition
7Question And Answer
3
4
▪The selection sort is a combination of searching
and sorting.
▪In selection sort, sorting is done after selecting a
particular smallest or largest element from an array
and shifted it to a particular location in an array.
▪During each pass, the unsorted element with the
smallest (or largest) value is moved to its proper
position in the array.
5
▪Let's look at our same table of elements
Using a selection sort for ascending order
▪The number of times the sort passes through
the array is one less than the number of items
in the array.
6
Selection Sort Example
Sorted Unsorted
23 78 45 8 32 56 Original List
8 78 45 23 32 56 After pass 1
8 23 45 78 32 56 After pass 1
8 23 32 78 45 56 After pass 1
8 23 32 45 78 56 After pass 1
8 23 32 45 56 78 After pass 1
7
Ascending order
Algorithm: Selection sort(L,N)
1 Repeat steps 2 to 6 for I=1 to N
2 set min:=I
3 Repeat steps 4 & 5 for J=I+1 to N
4 if list [J]<list [min] then
5 set lin:=J
6 swap (list [I],list [min])
7 End.
L=List of items.
N=Totel number of
items in the list .
8
▪ In the selection sort, the inner loop finds the next
smallest value and the outer loop places that value
into its proper location.
Array 40 50 60 10 30 20
1-
pass
10 50 60 40 30 20
2-
pass
10 20 60 40 30 50
3-
pass
10 20 30 40 60 50
4-
pass
10 20 30 40 60 50
5-
pass
10 20 30 40 50 60
9
Dscending order
Algorithm:selection sort(L,N)
1 Repeat steps 2 to 6 for I=1 to N
2 min:=I
3 Repeat steps 4 & 5 for J=I+1 to N
4 if list [J]>list [mix] then
5 set mix:=J
6 swap(list [I],list-[min])
7 End
L=list of items
N=Totel number
of items in the
list .
10
Array 70 50 11 10 40 20
1-
pass
70 50 11 10 40 20
2-
pass
70 50 11 10 40 20
3-
pass
70 50 40 10 11 20
4-
pass
70 50 40 20 11 10
5-
pass
70 50 40 20 11 10
▪In the selection sort, the inner loop finds the
next largest value and the outer loop places that
value into its proper location.
11
i:0; j:1 (7-1);min=I;if(arr[j]<arr[min]) {min=j;} finally sw
(a[i],a[min])
89 45 68 90 29 34 17
» 17| 45 68 90 29 34 89
i:1;j:2 (7-1); min=I;if(arr[j]<arr[min]) {min=j;} finally sw
(a[i],a[min])
17|45 68 90 29 34 89
»17|29 |68 90 45 34 89
12
i:2;j:3 (7-1); min=I;if(arr[j]<arr[min]) {min=j;}finally s
(a[i],a[min])
17|29 68 90 45 34 89
17|29|34| 90 45 68 89
Complexity is O(n2).
Kitkat
13
* Any query?
* Any question or any point which you doesn’t
14
THANK YOU!

More Related Content

What's hot (20)

PPT
Heaps
Hafiz Atif Amin
 
PPT
Selection Sort - Vipin Ramola
Dipayan Sarkar
 
PDF
Expression trees
Salman Vadsarya
 
PPTX
Selection sorting
Himanshu Kesharwani
 
PPTX
Insertion sort algorithm power point presentation
University of Science and Technology Chitttagong
 
PPTX
Linear Search Presentation
Markajul Hasnain Alif
 
PPTX
Quick sort
Afaq Mansoor Khan
 
PDF
Sorting Algorithms
Mohammed Hussein
 
PPTX
Linear search-and-binary-search
International Islamic University
 
PPTX
Priority Queue in Data Structure
Meghaj Mallick
 
PPTX
Queue ppt
SouravKumar328
 
PPT
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 
PPTX
Searching & Sorting Algorithms
Rahul Jamwal
 
PPTX
Queue in Data Structure
Janki Shah
 
PPTX
queue & its applications
somendra kumar
 
PDF
Selection sort
Abdelrahman Saleh
 
PPTX
Quick Sort
Shweta Sahu
 
PPTX
Linked list
KalaivaniKS1
 
PPTX
Data structure tries
Md. Naim khan
 
Selection Sort - Vipin Ramola
Dipayan Sarkar
 
Expression trees
Salman Vadsarya
 
Selection sorting
Himanshu Kesharwani
 
Insertion sort algorithm power point presentation
University of Science and Technology Chitttagong
 
Linear Search Presentation
Markajul Hasnain Alif
 
Quick sort
Afaq Mansoor Khan
 
Sorting Algorithms
Mohammed Hussein
 
Linear search-and-binary-search
International Islamic University
 
Priority Queue in Data Structure
Meghaj Mallick
 
Queue ppt
SouravKumar328
 
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 
Searching & Sorting Algorithms
Rahul Jamwal
 
Queue in Data Structure
Janki Shah
 
queue & its applications
somendra kumar
 
Selection sort
Abdelrahman Saleh
 
Quick Sort
Shweta Sahu
 
Linked list
KalaivaniKS1
 
Data structure tries
Md. Naim khan
 

Viewers also liked (11)

PPT
3.4 selection sort
Krish_ver2
 
PPT
Selection sort
amna izzat
 
PDF
Selection Sort
Daniel Arndt Alves
 
PPTX
The selection sort algorithm
David Burks-Courses
 
PPTX
Sorting techniques Anil Dutt
Anil Dutt
 
DOC
Selection sort
asra khan
 
PPTX
Sorting (Bubble,Merge,Selection sort)
oDesk
 
PDF
Intersection Study - Algorithm(Sort)
Jea Hyeun Jung
 
PPT
3.3 shell sort
Krish_ver2
 
PPT
Introduction to Algorithms
Venkatesh Iyer
 
PPTX
Advanced Sorting Algorithms
Damian T. Gordon
 
3.4 selection sort
Krish_ver2
 
Selection sort
amna izzat
 
Selection Sort
Daniel Arndt Alves
 
The selection sort algorithm
David Burks-Courses
 
Sorting techniques Anil Dutt
Anil Dutt
 
Selection sort
asra khan
 
Sorting (Bubble,Merge,Selection sort)
oDesk
 
Intersection Study - Algorithm(Sort)
Jea Hyeun Jung
 
3.3 shell sort
Krish_ver2
 
Introduction to Algorithms
Venkatesh Iyer
 
Advanced Sorting Algorithms
Damian T. Gordon
 
Ad

Similar to Selection sort 1 (20)

PPT
Searching Sorting-SELECTION ,BUBBBLE.ppt
kunalpatil5661
 
PPT
Data Structure (MC501)
Kamal Singh Lodhi
 
PPTX
Analysis and Design of Algorithms -Sorting Algorithms and analysis
Radhika Talaviya
 
PPTX
Searching and sorting Techniques in Data structures
PRIANKA R
 
PPTX
366 it elective 4 (analysis of algoritm)
Neil Soliven
 
PPTX
AJisthewewrtyuiojhghfdfsgvhjhklopi87ytrytfghjk
PradipTadme
 
PPTX
Sorting and hashing concepts
LJ Projects
 
PPTX
Sorting and hashing concepts
LJ Projects
 
PPTX
Searching and Sorting algorithms and working
RitikaLohiya2
 
PPTX
Sorting algorithms
Maher Alshammari
 
PPTX
sorting and searching.pptx
ParagAhir1
 
PPT
(Data Structure) Chapter11 searching & sorting
Fadhil Ismail
 
PPT
Sorting.ppt read only
VARSHAKUMARI49
 
PPT
16-sorting.ppt
18Gunaalanpg
 
PPTX
Unit vii sorting
Tribhuvan University
 
PPT
03_sorting and it's types with example .ppt
vanshii9976
 
PPT
quicksortnmsd cmz ,z m,zmm,mbfjjjjhjhfjsg
RafishaikIT02044
 
PPT
03_sorting123456789454545454545444543.ppt
ssuser7b9bda1
 
PPTX
Sorting and Its Types
amberkhan59
 
PDF
Sorting
Zaid Shabbir
 
Searching Sorting-SELECTION ,BUBBBLE.ppt
kunalpatil5661
 
Data Structure (MC501)
Kamal Singh Lodhi
 
Analysis and Design of Algorithms -Sorting Algorithms and analysis
Radhika Talaviya
 
Searching and sorting Techniques in Data structures
PRIANKA R
 
366 it elective 4 (analysis of algoritm)
Neil Soliven
 
AJisthewewrtyuiojhghfdfsgvhjhklopi87ytrytfghjk
PradipTadme
 
Sorting and hashing concepts
LJ Projects
 
Sorting and hashing concepts
LJ Projects
 
Searching and Sorting algorithms and working
RitikaLohiya2
 
Sorting algorithms
Maher Alshammari
 
sorting and searching.pptx
ParagAhir1
 
(Data Structure) Chapter11 searching & sorting
Fadhil Ismail
 
Sorting.ppt read only
VARSHAKUMARI49
 
16-sorting.ppt
18Gunaalanpg
 
Unit vii sorting
Tribhuvan University
 
03_sorting and it's types with example .ppt
vanshii9976
 
quicksortnmsd cmz ,z m,zmm,mbfjjjjhjhfjsg
RafishaikIT02044
 
03_sorting123456789454545454545444543.ppt
ssuser7b9bda1
 
Sorting and Its Types
amberkhan59
 
Sorting
Zaid Shabbir
 
Ad

Recently uploaded (20)

PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PPT
Oxygen Co2 Transport in the Lungs(Exchange og gases)
SUNDERLINSHIBUD
 
PDF
IoT - Unit 2 (Internet of Things-Concepts) - PPT.pdf
dipakraut82
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PDF
UNIT-4-FEEDBACK AMPLIFIERS AND OSCILLATORS (1).pdf
Sridhar191373
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
PDF
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
Oxygen Co2 Transport in the Lungs(Exchange og gases)
SUNDERLINSHIBUD
 
IoT - Unit 2 (Internet of Things-Concepts) - PPT.pdf
dipakraut82
 
Hashing Introduction , hash functions and techniques
sailajam21
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
UNIT-4-FEEDBACK AMPLIFIERS AND OSCILLATORS (1).pdf
Sridhar191373
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
Pharmaceuticals and fine chemicals.pptxx
jaypa242004
 
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 

Selection sort 1

  • 2. Submitted by: 1 Arifarina 2 sakil 3 sabuj sarkar 4 Himu Submitted to: Mr.Tahzibul Islam Lecturer,Department of cse.Dhaka International University. 2 DATA STRUCTURES-CSE 205 PRESENTATION
  • 3. ROAD MAP 1 Definition 2 Example 3 Algorithm 4 Ascending And Dscending order. 6 Mathematical definition 7Question And Answer 3
  • 4. 4 ▪The selection sort is a combination of searching and sorting. ▪In selection sort, sorting is done after selecting a particular smallest or largest element from an array and shifted it to a particular location in an array. ▪During each pass, the unsorted element with the smallest (or largest) value is moved to its proper position in the array.
  • 5. 5 ▪Let's look at our same table of elements Using a selection sort for ascending order ▪The number of times the sort passes through the array is one less than the number of items in the array.
  • 6. 6 Selection Sort Example Sorted Unsorted 23 78 45 8 32 56 Original List 8 78 45 23 32 56 After pass 1 8 23 45 78 32 56 After pass 1 8 23 32 78 45 56 After pass 1 8 23 32 45 78 56 After pass 1 8 23 32 45 56 78 After pass 1
  • 7. 7 Ascending order Algorithm: Selection sort(L,N) 1 Repeat steps 2 to 6 for I=1 to N 2 set min:=I 3 Repeat steps 4 & 5 for J=I+1 to N 4 if list [J]<list [min] then 5 set lin:=J 6 swap (list [I],list [min]) 7 End. L=List of items. N=Totel number of items in the list .
  • 8. 8 ▪ In the selection sort, the inner loop finds the next smallest value and the outer loop places that value into its proper location. Array 40 50 60 10 30 20 1- pass 10 50 60 40 30 20 2- pass 10 20 60 40 30 50 3- pass 10 20 30 40 60 50 4- pass 10 20 30 40 60 50 5- pass 10 20 30 40 50 60
  • 9. 9 Dscending order Algorithm:selection sort(L,N) 1 Repeat steps 2 to 6 for I=1 to N 2 min:=I 3 Repeat steps 4 & 5 for J=I+1 to N 4 if list [J]>list [mix] then 5 set mix:=J 6 swap(list [I],list-[min]) 7 End L=list of items N=Totel number of items in the list .
  • 10. 10 Array 70 50 11 10 40 20 1- pass 70 50 11 10 40 20 2- pass 70 50 11 10 40 20 3- pass 70 50 40 10 11 20 4- pass 70 50 40 20 11 10 5- pass 70 50 40 20 11 10 ▪In the selection sort, the inner loop finds the next largest value and the outer loop places that value into its proper location.
  • 11. 11 i:0; j:1 (7-1);min=I;if(arr[j]<arr[min]) {min=j;} finally sw (a[i],a[min]) 89 45 68 90 29 34 17 » 17| 45 68 90 29 34 89 i:1;j:2 (7-1); min=I;if(arr[j]<arr[min]) {min=j;} finally sw (a[i],a[min]) 17|45 68 90 29 34 89 »17|29 |68 90 45 34 89
  • 12. 12 i:2;j:3 (7-1); min=I;if(arr[j]<arr[min]) {min=j;}finally s (a[i],a[min]) 17|29 68 90 45 34 89 17|29|34| 90 45 68 89 Complexity is O(n2). Kitkat
  • 13. 13 * Any query? * Any question or any point which you doesn’t