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

Selection sorting
Selection sortingSelection sorting
Selection sorting
Himanshu Kesharwani
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Mohammed Hussein
 
Selection sort
Selection sortSelection sort
Selection sortJay Patel
 
Shell sort in Data Structure Using C
Shell sort in Data Structure Using CShell sort in Data Structure Using C
Shell sort in Data Structure Using CAshish Gaurkhede
 
Shell sort
Shell sortShell sort
Shell sort
Rajendran
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
University of Science and Technology Chitttagong
 
Binary search
Binary searchBinary search
Binary search
AparnaKumari31
 
Algorithm: Quick-Sort
Algorithm: Quick-SortAlgorithm: Quick-Sort
Algorithm: Quick-Sort
Tareq Hasan
 
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
University of Science and Technology Chitttagong
 
Insertion sort
Insertion sortInsertion sort
Insertion sortMYER301
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
International Islamic University
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
 
Insertion sort
Insertion sortInsertion sort
Quick sort
Quick sortQuick sort
Quick sort
amar kakde
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
Shellshort ppt
Shellshort pptShellshort ppt
Shellshort ppt
hannatamayao
 
Quick sort
Quick sortQuick sort
Quick sort
Jehat Hassan
 
Quick sort
Quick sortQuick sort
Quick sort
Dhruv Sabalpara
 
Quick sort
Quick sortQuick sort
Quick sort
Afaq Mansoor Khan
 
Radix and Shell sort
Radix and Shell sortRadix and Shell sort
Radix and Shell sort
hannatamayao
 

What's hot (20)

Selection sorting
Selection sortingSelection sorting
Selection sorting
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Selection sort
Selection sortSelection sort
Selection sort
 
Shell sort in Data Structure Using C
Shell sort in Data Structure Using CShell sort in Data Structure Using C
Shell sort in Data Structure Using C
 
Shell sort
Shell sortShell sort
Shell sort
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
 
Binary search
Binary searchBinary search
Binary search
 
Algorithm: Quick-Sort
Algorithm: Quick-SortAlgorithm: Quick-Sort
Algorithm: Quick-Sort
 
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
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Quick sort
Quick sortQuick sort
Quick sort
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Shellshort ppt
Shellshort pptShellshort ppt
Shellshort ppt
 
Quick sort
Quick sortQuick sort
Quick sort
 
Quick sort
Quick sortQuick sort
Quick sort
 
Quick sort
Quick sortQuick sort
Quick sort
 
Radix and Shell sort
Radix and Shell sortRadix and Shell sort
Radix and Shell sort
 

Viewers also liked

3.4 selection sort
3.4 selection sort3.4 selection sort
3.4 selection sort
Krish_ver2
 
Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin Ramola
Dipayan Sarkar
 
Selection Sort
Selection SortSelection Sort
Selection Sort
Daniel Arndt Alves
 
The selection sort algorithm
The selection sort algorithmThe selection sort algorithm
The selection sort algorithm
David Burks-Courses
 
Sorting techniques Anil Dutt
Sorting techniques Anil DuttSorting techniques Anil Dutt
Sorting techniques Anil Dutt
Anil Dutt
 
Selection sort
Selection sortSelection sort
Selection sortasra khan
 
Sorting (Bubble,Merge,Selection sort)
Sorting (Bubble,Merge,Selection sort)Sorting (Bubble,Merge,Selection sort)
Sorting (Bubble,Merge,Selection sort)
oDesk
 
Intersection Study - Algorithm(Sort)
Intersection Study - Algorithm(Sort)Intersection Study - Algorithm(Sort)
Intersection Study - Algorithm(Sort)
Jea Hyeun Jung
 
3.3 shell sort
3.3 shell sort3.3 shell sort
3.3 shell sort
Krish_ver2
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
 
Advanced Sorting Algorithms
Advanced Sorting AlgorithmsAdvanced Sorting Algorithms
Advanced Sorting Algorithms
Damian T. Gordon
 

Viewers also liked (11)

3.4 selection sort
3.4 selection sort3.4 selection sort
3.4 selection sort
 
Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin Ramola
 
Selection Sort
Selection SortSelection Sort
Selection Sort
 
The selection sort algorithm
The selection sort algorithmThe selection sort algorithm
The selection sort algorithm
 
Sorting techniques Anil Dutt
Sorting techniques Anil DuttSorting techniques Anil Dutt
Sorting techniques Anil Dutt
 
Selection sort
Selection sortSelection sort
Selection sort
 
Sorting (Bubble,Merge,Selection sort)
Sorting (Bubble,Merge,Selection sort)Sorting (Bubble,Merge,Selection sort)
Sorting (Bubble,Merge,Selection sort)
 
Intersection Study - Algorithm(Sort)
Intersection Study - Algorithm(Sort)Intersection Study - Algorithm(Sort)
Intersection Study - Algorithm(Sort)
 
3.3 shell sort
3.3 shell sort3.3 shell sort
3.3 shell sort
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
 
Advanced Sorting Algorithms
Advanced Sorting AlgorithmsAdvanced Sorting Algorithms
Advanced Sorting Algorithms
 

Similar to Selection sort 1

Data Structure (MC501)
Data Structure (MC501)Data Structure (MC501)
Data Structure (MC501)
Kamal Singh Lodhi
 
Analysis and Design of Algorithms -Sorting Algorithms and analysis
Analysis and Design of Algorithms -Sorting Algorithms and analysisAnalysis and Design of Algorithms -Sorting Algorithms and analysis
Analysis and Design of Algorithms -Sorting Algorithms and analysis
Radhika Talaviya
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 
Searching and sorting Techniques in Data structures
Searching and sorting Techniques in Data structuresSearching and sorting Techniques in Data structures
Searching and sorting Techniques in Data structures
PRIANKA R
 
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
 
Sorting and hashing concepts
Sorting and hashing conceptsSorting and hashing concepts
Sorting and hashing concepts
LJ Projects
 
Sorting and hashing concepts
Sorting and hashing conceptsSorting and hashing concepts
Sorting and hashing concepts
LJ Projects
 
sorting and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptx
ParagAhir1
 
(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sortingFadhil Ismail
 
Sorting.ppt read only
Sorting.ppt read onlySorting.ppt read only
Sorting.ppt read only
VARSHAKUMARI49
 
16-sorting.ppt
16-sorting.ppt16-sorting.ppt
16-sorting.ppt
18Gunaalanpg
 
Unit vii sorting
Unit   vii sorting Unit   vii sorting
Unit vii sorting
Tribhuvan University
 
Sorting and Its Types
Sorting and Its TypesSorting and Its Types
Sorting and Its Types
amberkhan59
 
Sorting
SortingSorting
Sorting
Zaid Shabbir
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsAakash deep Singhal
 
Sorting
SortingSorting
Sorting
Saharamily
 
Data Structures - Lecture 8 [Sorting Algorithms]
Data Structures - Lecture 8 [Sorting Algorithms]Data Structures - Lecture 8 [Sorting Algorithms]
Data Structures - Lecture 8 [Sorting Algorithms]
Muhammad Hammad Waseem
 
sorting algorithm graphical method
sorting algorithm graphical method sorting algorithm graphical method
sorting algorithm graphical method
Shantanu Mishra
 

Similar to Selection sort 1 (20)

Data Structure (MC501)
Data Structure (MC501)Data Structure (MC501)
Data Structure (MC501)
 
Analysis and Design of Algorithms -Sorting Algorithms and analysis
Analysis and Design of Algorithms -Sorting Algorithms and analysisAnalysis and Design of Algorithms -Sorting Algorithms and analysis
Analysis and Design of Algorithms -Sorting Algorithms and analysis
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
 
Searching and sorting Techniques in Data structures
Searching and sorting Techniques in Data structuresSearching and sorting Techniques in Data structures
Searching and sorting Techniques in Data structures
 
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)
 
Sorting and hashing concepts
Sorting and hashing conceptsSorting and hashing concepts
Sorting and hashing concepts
 
Sorting and hashing concepts
Sorting and hashing conceptsSorting and hashing concepts
Sorting and hashing concepts
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
sorting and searching.pptx
sorting and searching.pptxsorting and searching.pptx
sorting and searching.pptx
 
(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting(Data Structure) Chapter11 searching & sorting
(Data Structure) Chapter11 searching & sorting
 
Sorting.ppt read only
Sorting.ppt read onlySorting.ppt read only
Sorting.ppt read only
 
16-sorting.ppt
16-sorting.ppt16-sorting.ppt
16-sorting.ppt
 
Unit vii sorting
Unit   vii sorting Unit   vii sorting
Unit vii sorting
 
Sorting and Its Types
Sorting and Its TypesSorting and Its Types
Sorting and Its Types
 
Sorting
SortingSorting
Sorting
 
Sorting
SortingSorting
Sorting
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithms
 
Sorting
SortingSorting
Sorting
 
Data Structures - Lecture 8 [Sorting Algorithms]
Data Structures - Lecture 8 [Sorting Algorithms]Data Structures - Lecture 8 [Sorting Algorithms]
Data Structures - Lecture 8 [Sorting Algorithms]
 
sorting algorithm graphical method
sorting algorithm graphical method sorting algorithm graphical method
sorting algorithm graphical method
 

Recently uploaded

Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 

Recently uploaded (20)

Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 

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