SlideShare a Scribd company logo
Adam Mukharil Bachtiar
English Class
Informatics Engineering 2011
Algorithms and Programming
Sorting
Steps of the Day
Let’s Start
Definition of
Sorting
Bubble Sort Selection
Sort
Definition of Sorting
All About Sorting
WhatisSorting
Process that arranges random data into sorted
data. Data can be sorted into ascending or
descending.
AlgorithmsofSorting
• Bubble Sort
• Selection Sort
Bubble Sort
Definition and Structures of Bubble Sort
WhatisBubbleSort
• Sorting algorithm which was inspired by
bubble soap.
• Comparing element of array (i) with next
element of it (i+1).
• If i is bigger than i+1 then swap value of
each element.
Ilustration of Bubble Sort
Array: 5 3 7 9 2 3 6 4 3 1
L. 1 3 5 7 2 3 6 4 3 1 9
L. 2 3 5 2 3 6 4 3 1 7 9
L. 3 3 2 3 5 4 3 1 6 7 9
L. 4 2 3 3 4 3 1 5 6 7 9
L. 5 2 3 3 3 1 4 5 6 7 9
L. 6 2 3 3 1 3 4 5 6 7 9
L. 7 2 3 1 3 3 4 5 6 7 9
L. 8 2 1 3 3 3 4 5 6 7 9
L. 9 1 2 3 3 3 4 5 6 7 9
Process of Bubble Sort (Ascending)
This is an array that will be sorted in Ascending way:
6 3 9 1 5
Step 1 : 6 3 9 1 5
6 3 9 1 5
6 3 1 9 5
6 1 3 9 5
1 6 3 9 5
j
j
j
j
Process of Bubble Sort (Ascending)
Step 2 : 1 6 3 9 5
1 6 3 5 9
1 6 3 5 9
1 3 6 5 9
j
j
j
Process of Bubble Sort (Ascending)
Step 3 : 1 3 6 5 9
1 3 6 5 9
1 3 5 6 9
Step 4 : 1 3 5 6 9
1 3 5 6 9
Array after sorted in ascending ways:
1 3 5 6 9
j
j
j
General Format for Bubble Sort Ascending
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Procedure BubbleSortAsc(I/O nama_var_array : nama_tipe_array,
Input N : integer)
{I.S. : array[1..N] sudah terdefinisi}
{F.S. : menghasilkan array[1..N] yang tersusun secara ascending}
Kamus:
i, j : integer
temp : tipedata
Algoritma:
for i  1 to N-1 do
for j  n downto i+1 do
if(nama_var_array[j] < nama_var_array[j-1])
then
temp  nama_var_array[j]
nama_var_array[j]  nama_var_array[j-1]
nama_var_array[j-1]  temp
endif
endfor
endfor
EndProcedure
Process of Bubble Sort (Descending)
This is an array that will be sorted in Descending way :
6 3 9 1 5
Step 1 : 6 3 9 1 5
6 3 9 1 5
6 9 3 1 5
6 9 3 1 5
6 9 3 5 1
j
j
j
j
Process of Bubble Sort (Descending)
Step 2 : 6 9 3 5 1
9 6 3 5 1
9 6 3 5 1
9 6 5 3 1
j
j
j
Process of Bubble Sort (Descending)
Step 3 : 9 6 5 3 1
9 6 5 3 1
9 6 5 3 1
Step 4 : 9 6 5 3 1
9 6 5 3 1
Array after sorted in descending ways:
9 6 5 3 1
j
j
j
General Format for Bubble Sort Descending
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Procedure BubbleSortDesc (I/O nama_var_array : nama_tipe_array,
Input N : integer)
{I.S. : array[1..N] sudah terdefinisi}
{F.S. : menghasilkan array[1..N] yang tersusun secara descending}
Kamus:
i,j : integer
temp : tipedata
Algoritma:
for i  1 to N-1 do
for j  1 to (N - i) do
if(nama_var_array[j] < nama_var_array[j+1])
then
temp  nama_var_array[j]
nama_var_array[j]  nama_var_array[j+1]
nama_var_array[j+1]  temp
endif
endfor
endfor
EndProcedure
Selection Sort
Definition and Structures of Selection Sort
WhatisSelectionSort
Sorting algorithm that arranges random data
by selecting the biggest data or the smallest
one.
MethodsinSelectionSort
• Maximum Sort
• Minimum Sort
Process of Maximum Sort (Ascending)
This is an array that will be sorted in Ascending way :
6 3 9 1 5
Step 1 : 6 3 9 1 5
6 3 9 1 5
6 3 9 1 5
6 3 9 1 5
6 3 9 1 5
6 3 5 1 9
j
j
j
jmax
max
max
max
max j
Process of Maximum Sort (Ascending)
Step 2 : 6 3 5 1 9
6 3 5 1 9
6 3 5 1 9
6 3 5 1 9
1 3 5 6 9
j
j
jmax
max
max
max j
Process of Maximum Sort (Ascending)
Step 3 : 1 3 5 6 9
1 3 5 6 9
1 3 5 6 9
1 3 5 6 9
Step 4 : 1 3 5 6 9
1 3 5 6 9
Array after sorted in descending way:
1 3 5 6 9
j
j
max
max
max
max
j
j
max
General Format for Maximum Sort Ascending
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Procedure MaximumSortAsc(I/O nama_var_array : nama_tipe_array,
Input N : integer)
{I.S. : array [1..N] sudah terdefinisi}
{F.S. : menghasilkan array [1..N] yang tersusun secara ascending}
Kamus:
i, j, max, x : integer
temp : tipedata
Algoritma:
x  n
for i  1 to N-1 do
max  1
for j  2 to x do
if(nama_var_array[j] > nama_var_array[max])
then
max  j
endif
endfor
temp  nama_var_array[max]
nama_var_array[max]  nama_var_array[j]
nama_var_array[j]  temp
x  x - 1
endfor
EndProcedure
General Format for Minimum Sort Ascending
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Procedure MinimumSortAsc(I/O nama_var_array : nama_tipe_array,
Input N : integer)
{I.S. : array[1..n] sudah terdefinisi}
{F.S. : menghasilkan array [1..n] yang tersusun secara ascending}
Kamus:
i, j, min : integer
temp : tipedata
Algoritma:
for i  1 to (N – 1) do
min  i
for j  i+1 to N do
if(nama_var_array[j] < nama_var_array[min])
then
min  j
endif
endfor
temp  nama_var_array[min]
nama_var_array[min]  nama_var_array[i]
nama_var_array[i]  temp
endfor
EndProcedure
Contact Person:
Adam Mukharil Bachtiar
Informatics Engineering UNIKOM
Jalan Dipati Ukur Nomor. 112-114 Bandung 40132
Email: adfbipotter@gmail.com
Blog: http://adfbipotter.wordpress.com
Copyright © Adam Mukharil Bachtiar 2011

More Related Content

What's hot (20)

Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin Ramola
Dipayan Sarkar
 
Prefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix NotationsPrefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix Notations
Afaq Mansoor Khan
 
Selection sort
Selection sortSelection sort
Selection sort
Jay Patel
 
convex hull
convex hullconvex hull
convex hull
ravikirankalal
 
Python-List.pptx
Python-List.pptxPython-List.pptx
Python-List.pptx
AnitaDevi158873
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Pranay Neema
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Zidny Nafan
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)
PyData
 
Binary search python
Binary search pythonBinary search python
Binary search python
MaryamAnwar10
 
dynamic programming Rod cutting class
dynamic programming Rod cutting classdynamic programming Rod cutting class
dynamic programming Rod cutting class
giridaroori
 
Insertion operation in array(ds)
Insertion operation in array(ds)Insertion operation in array(ds)
Insertion operation in array(ds)
chauhankapil
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
Raj Naik
 
Fuzzy sets
Fuzzy sets Fuzzy sets
Fuzzy sets
ABSARQURESHI
 
Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)
Flynce Miguel
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture Notes
FellowBuddy.com
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
Rahul Jamwal
 
Searching and sorting
Searching  and sortingSearching  and sorting
Searching and sorting
PoojithaBollikonda
 
Trees in data structures
Trees in data structuresTrees in data structures
Trees in data structures
ASairamSairam1
 
Set Theory
Set TheorySet Theory
Set Theory
itutor
 
Selection sort
Selection sortSelection sort
Selection sort
stella D
 
Selection Sort - Vipin Ramola
Selection Sort - Vipin RamolaSelection Sort - Vipin Ramola
Selection Sort - Vipin Ramola
Dipayan Sarkar
 
Prefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix NotationsPrefix, Infix and Post-fix Notations
Prefix, Infix and Post-fix Notations
Afaq Mansoor Khan
 
Selection sort
Selection sortSelection sort
Selection sort
Jay Patel
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Pranay Neema
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Zidny Nafan
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)
PyData
 
Binary search python
Binary search pythonBinary search python
Binary search python
MaryamAnwar10
 
dynamic programming Rod cutting class
dynamic programming Rod cutting classdynamic programming Rod cutting class
dynamic programming Rod cutting class
giridaroori
 
Insertion operation in array(ds)
Insertion operation in array(ds)Insertion operation in array(ds)
Insertion operation in array(ds)
chauhankapil
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
Raj Naik
 
Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)
Flynce Miguel
 
Design & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture NotesDesign & Analysis of Algorithms Lecture Notes
Design & Analysis of Algorithms Lecture Notes
FellowBuddy.com
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
Rahul Jamwal
 
Trees in data structures
Trees in data structuresTrees in data structures
Trees in data structures
ASairamSairam1
 
Set Theory
Set TheorySet Theory
Set Theory
itutor
 
Selection sort
Selection sortSelection sort
Selection sort
stella D
 

Viewers also liked (20)

Algorithm and Programming (Branching Structure)
Algorithm and Programming (Branching Structure)Algorithm and Programming (Branching Structure)
Algorithm and Programming (Branching Structure)
Adam Mukharil Bachtiar
 
Algorithm and Programming (Record)
Algorithm and Programming (Record)Algorithm and Programming (Record)
Algorithm and Programming (Record)
Adam Mukharil Bachtiar
 
Algorithm and Programming (Searching)
Algorithm and Programming (Searching)Algorithm and Programming (Searching)
Algorithm and Programming (Searching)
Adam Mukharil Bachtiar
 
Algorithm and Programming (Array)
Algorithm and Programming (Array)Algorithm and Programming (Array)
Algorithm and Programming (Array)
Adam Mukharil Bachtiar
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)
Adam Mukharil Bachtiar
 
9. Searching & Sorting - Data Structures using C++ by Varsha Patil
9. Searching & Sorting - Data Structures using C++ by Varsha Patil9. Searching & Sorting - Data Structures using C++ by Varsha Patil
9. Searching & Sorting - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
Algorithm and Programming (Looping Structure)
Algorithm and Programming (Looping Structure)Algorithm and Programming (Looping Structure)
Algorithm and Programming (Looping Structure)
Adam Mukharil Bachtiar
 
Jjj sem título 1
Jjj sem título 1Jjj sem título 1
Jjj sem título 1
Juliana De Souza Pereira
 
Ground SIGINT Specialist - Afghanistan
Ground SIGINT Specialist - AfghanistanGround SIGINT Specialist - Afghanistan
Ground SIGINT Specialist - Afghanistan
Angelene Green
 
Mid Level Counterintelligence Support Specialist - Afghanistan
Mid Level Counterintelligence Support Specialist - AfghanistanMid Level Counterintelligence Support Specialist - Afghanistan
Mid Level Counterintelligence Support Specialist - Afghanistan
Angelene Green
 
Linx Nòrdic 1r ESO La Salle Manlleu 2016
Linx Nòrdic 1r ESO La Salle Manlleu 2016Linx Nòrdic 1r ESO La Salle Manlleu 2016
Linx Nòrdic 1r ESO La Salle Manlleu 2016
Annapujolo
 
Introdução ao Teste de Software
Introdução ao Teste de SoftwareIntrodução ao Teste de Software
Introdução ao Teste de Software
X25 Treinamento e Consultoria
 
La pluja àcida - 1r ESO - LS Manlleu 2016
La pluja àcida - 1r ESO - LS Manlleu 2016La pluja àcida - 1r ESO - LS Manlleu 2016
La pluja àcida - 1r ESO - LS Manlleu 2016
Annapujolo
 
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Adam Mukharil Bachtiar
 
Algorithm and Programming (Sequential Structure)
Algorithm and Programming (Sequential Structure)Algorithm and Programming (Sequential Structure)
Algorithm and Programming (Sequential Structure)
Adam Mukharil Bachtiar
 
Pertemuan viii Sorting
Pertemuan viii SortingPertemuan viii Sorting
Pertemuan viii Sorting
Putra Andry
 
certificate in health and safety level 2
certificate in health and safety level 2certificate in health and safety level 2
certificate in health and safety level 2
Luca De Rosa
 
Certificate for Peer Review Week '16 _ Publons
Certificate for Peer Review Week '16 _ PublonsCertificate for Peer Review Week '16 _ Publons
Certificate for Peer Review Week '16 _ Publons
Mohamad Amin Kaviani
 
Amyotrophic Lateral Sclerosis (ALS)
Amyotrophic Lateral Sclerosis (ALS) Amyotrophic Lateral Sclerosis (ALS)
Amyotrophic Lateral Sclerosis (ALS)
Uma Chidiebere
 
Bucaramanga en los últimos 25 años
Bucaramanga en los últimos 25 añosBucaramanga en los últimos 25 años
Bucaramanga en los últimos 25 años
josenino2002
 
Algorithm and Programming (Branching Structure)
Algorithm and Programming (Branching Structure)Algorithm and Programming (Branching Structure)
Algorithm and Programming (Branching Structure)
Adam Mukharil Bachtiar
 
Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)Algorithm and Programming (Introduction of Algorithms)
Algorithm and Programming (Introduction of Algorithms)
Adam Mukharil Bachtiar
 
9. Searching & Sorting - Data Structures using C++ by Varsha Patil
9. Searching & Sorting - Data Structures using C++ by Varsha Patil9. Searching & Sorting - Data Structures using C++ by Varsha Patil
9. Searching & Sorting - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
Algorithm and Programming (Looping Structure)
Algorithm and Programming (Looping Structure)Algorithm and Programming (Looping Structure)
Algorithm and Programming (Looping Structure)
Adam Mukharil Bachtiar
 
Ground SIGINT Specialist - Afghanistan
Ground SIGINT Specialist - AfghanistanGround SIGINT Specialist - Afghanistan
Ground SIGINT Specialist - Afghanistan
Angelene Green
 
Mid Level Counterintelligence Support Specialist - Afghanistan
Mid Level Counterintelligence Support Specialist - AfghanistanMid Level Counterintelligence Support Specialist - Afghanistan
Mid Level Counterintelligence Support Specialist - Afghanistan
Angelene Green
 
Linx Nòrdic 1r ESO La Salle Manlleu 2016
Linx Nòrdic 1r ESO La Salle Manlleu 2016Linx Nòrdic 1r ESO La Salle Manlleu 2016
Linx Nòrdic 1r ESO La Salle Manlleu 2016
Annapujolo
 
La pluja àcida - 1r ESO - LS Manlleu 2016
La pluja àcida - 1r ESO - LS Manlleu 2016La pluja àcida - 1r ESO - LS Manlleu 2016
La pluja àcida - 1r ESO - LS Manlleu 2016
Annapujolo
 
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Adam Mukharil Bachtiar
 
Algorithm and Programming (Sequential Structure)
Algorithm and Programming (Sequential Structure)Algorithm and Programming (Sequential Structure)
Algorithm and Programming (Sequential Structure)
Adam Mukharil Bachtiar
 
Pertemuan viii Sorting
Pertemuan viii SortingPertemuan viii Sorting
Pertemuan viii Sorting
Putra Andry
 
certificate in health and safety level 2
certificate in health and safety level 2certificate in health and safety level 2
certificate in health and safety level 2
Luca De Rosa
 
Certificate for Peer Review Week '16 _ Publons
Certificate for Peer Review Week '16 _ PublonsCertificate for Peer Review Week '16 _ Publons
Certificate for Peer Review Week '16 _ Publons
Mohamad Amin Kaviani
 
Amyotrophic Lateral Sclerosis (ALS)
Amyotrophic Lateral Sclerosis (ALS) Amyotrophic Lateral Sclerosis (ALS)
Amyotrophic Lateral Sclerosis (ALS)
Uma Chidiebere
 
Bucaramanga en los últimos 25 años
Bucaramanga en los últimos 25 añosBucaramanga en los últimos 25 años
Bucaramanga en los últimos 25 años
josenino2002
 
Ad

Similar to Algorithm and Programming (Sorting) (20)

bubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly languagebubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly language
Bilal Amjad
 
Sorting algorithm
Sorting algorithmSorting algorithm
Sorting algorithm
Muhammad Farhan
 
Bubble sorting lab manual
Bubble sorting lab manualBubble sorting lab manual
Bubble sorting lab manual
maamir farooq
 
Sorting
SortingSorting
Sorting
Shaista Qadir
 
Sorting Data structure And Algorithm.pptx
Sorting Data structure And Algorithm.pptxSorting Data structure And Algorithm.pptx
Sorting Data structure And Algorithm.pptx
subhanalichand514
 
Computer sciencebubble sorting algorithm
Computer sciencebubble sorting algorithmComputer sciencebubble sorting algorithm
Computer sciencebubble sorting algorithm
hebahosny20060467
 
Ppt bubble sort
Ppt bubble sortPpt bubble sort
Ppt bubble sort
prabhakar jalasutram
 
Sorting method data structure
Sorting method data structureSorting method data structure
Sorting method data structure
sunilchute1
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithms
Aakash deep Singhal
 
Sorting
SortingSorting
Sorting
Kariman Karm Gabaa
 
Basic Sorting algorithms csharp
Basic Sorting algorithms csharpBasic Sorting algorithms csharp
Basic Sorting algorithms csharp
Micheal Ogundero
 
enhancement of sorting algorithm
enhancement of sorting algorithmenhancement of sorting algorithm
enhancement of sorting algorithm
Rana assad ali
 
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASE BUBLESORT.pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASE BUBLESORT.pptxMYSQL DATABASE MYSQL DATABASE MYSQL DATABASE BUBLESORT.pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASE BUBLESORT.pptx
ArjayBalberan1
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
Selection sort
Selection sortSelection sort
Selection sort
Abdelrahman Saleh
 
Unit 7 sorting
Unit   7 sortingUnit   7 sorting
Unit 7 sorting
Dabbal Singh Mahara
 
Selection Sort On C++.ppt.pptx
Selection Sort On C++.ppt.pptxSelection Sort On C++.ppt.pptx
Selection Sort On C++.ppt.pptx
MuneebUrRehman643659
 
COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5
Vishal Patil
 
DSA_chapter and chapter 3 _03_Sorting Algorithms.pptx
DSA_chapter and chapter 3 _03_Sorting Algorithms.pptxDSA_chapter and chapter 3 _03_Sorting Algorithms.pptx
DSA_chapter and chapter 3 _03_Sorting Algorithms.pptx
tahliildhoore54
 
358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14
sumitbardhan
 
bubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly languagebubble sorting of an array in 8086 assembly language
bubble sorting of an array in 8086 assembly language
Bilal Amjad
 
Bubble sorting lab manual
Bubble sorting lab manualBubble sorting lab manual
Bubble sorting lab manual
maamir farooq
 
Sorting Data structure And Algorithm.pptx
Sorting Data structure And Algorithm.pptxSorting Data structure And Algorithm.pptx
Sorting Data structure And Algorithm.pptx
subhanalichand514
 
Computer sciencebubble sorting algorithm
Computer sciencebubble sorting algorithmComputer sciencebubble sorting algorithm
Computer sciencebubble sorting algorithm
hebahosny20060467
 
Sorting method data structure
Sorting method data structureSorting method data structure
Sorting method data structure
sunilchute1
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithms
Aakash deep Singhal
 
Basic Sorting algorithms csharp
Basic Sorting algorithms csharpBasic Sorting algorithms csharp
Basic Sorting algorithms csharp
Micheal Ogundero
 
enhancement of sorting algorithm
enhancement of sorting algorithmenhancement of sorting algorithm
enhancement of sorting algorithm
Rana assad ali
 
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASE BUBLESORT.pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASE BUBLESORT.pptxMYSQL DATABASE MYSQL DATABASE MYSQL DATABASE BUBLESORT.pptx
MYSQL DATABASE MYSQL DATABASE MYSQL DATABASE BUBLESORT.pptx
ArjayBalberan1
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5COMPUTER PROGRAMMING UNIT 1 Lecture 5
COMPUTER PROGRAMMING UNIT 1 Lecture 5
Vishal Patil
 
DSA_chapter and chapter 3 _03_Sorting Algorithms.pptx
DSA_chapter and chapter 3 _03_Sorting Algorithms.pptxDSA_chapter and chapter 3 _03_Sorting Algorithms.pptx
DSA_chapter and chapter 3 _03_Sorting Algorithms.pptx
tahliildhoore54
 
358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14
sumitbardhan
 
Ad

More from Adam Mukharil Bachtiar (20)

Materi 8 - Data Mining Association Rule.pdf
Materi 8 - Data Mining Association Rule.pdfMateri 8 - Data Mining Association Rule.pdf
Materi 8 - Data Mining Association Rule.pdf
Adam Mukharil Bachtiar
 
Clean Code - Formatting Code
Clean Code - Formatting CodeClean Code - Formatting Code
Clean Code - Formatting Code
Adam Mukharil Bachtiar
 
Clean Code - Clean Comments
Clean Code - Clean CommentsClean Code - Clean Comments
Clean Code - Clean Comments
Adam Mukharil Bachtiar
 
Clean Method
Clean MethodClean Method
Clean Method
Adam Mukharil Bachtiar
 
Clean Code and Design Pattern - Meaningful Names
Clean Code and Design Pattern - Meaningful NamesClean Code and Design Pattern - Meaningful Names
Clean Code and Design Pattern - Meaningful Names
Adam Mukharil Bachtiar
 
Model Driven Software Development
Model Driven Software DevelopmentModel Driven Software Development
Model Driven Software Development
Adam Mukharil Bachtiar
 
Scrum: How to Implement
Scrum: How to ImplementScrum: How to Implement
Scrum: How to Implement
Adam Mukharil Bachtiar
 
Pengujian Perangkat Lunak
Pengujian Perangkat LunakPengujian Perangkat Lunak
Pengujian Perangkat Lunak
Adam Mukharil Bachtiar
 
Data Mining Clustering
Data Mining ClusteringData Mining Clustering
Data Mining Clustering
Adam Mukharil Bachtiar
 
Data Mining Klasifikasi (Updated 30 Desember 2020)
Data Mining Klasifikasi (Updated 30 Desember 2020)Data Mining Klasifikasi (Updated 30 Desember 2020)
Data Mining Klasifikasi (Updated 30 Desember 2020)
Adam Mukharil Bachtiar
 
Analisis Algoritma - Strategi Algoritma Dynamic Programming
Analisis Algoritma - Strategi Algoritma Dynamic ProgrammingAnalisis Algoritma - Strategi Algoritma Dynamic Programming
Analisis Algoritma - Strategi Algoritma Dynamic Programming
Adam Mukharil Bachtiar
 
Analisis Algoritma - Strategi Algoritma Divide and Conquer
Analisis Algoritma - Strategi Algoritma Divide and ConquerAnalisis Algoritma - Strategi Algoritma Divide and Conquer
Analisis Algoritma - Strategi Algoritma Divide and Conquer
Adam Mukharil Bachtiar
 
Analisis Algoritma - Strategi Algoritma Greedy
Analisis Algoritma - Strategi Algoritma GreedyAnalisis Algoritma - Strategi Algoritma Greedy
Analisis Algoritma - Strategi Algoritma Greedy
Adam Mukharil Bachtiar
 
Analisis Algoritma - Penerapan Strategi Algoritma Brute Force
Analisis Algoritma - Penerapan Strategi Algoritma Brute ForceAnalisis Algoritma - Penerapan Strategi Algoritma Brute Force
Analisis Algoritma - Penerapan Strategi Algoritma Brute Force
Adam Mukharil Bachtiar
 
Analisis Algoritma - Strategi Algoritma Brute Force
Analisis Algoritma - Strategi Algoritma Brute ForceAnalisis Algoritma - Strategi Algoritma Brute Force
Analisis Algoritma - Strategi Algoritma Brute Force
Adam Mukharil Bachtiar
 
Analisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
Analisis Algoritma - Kelas-kelas Dasar Efisiensi AlgoritmaAnalisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
Analisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
Adam Mukharil Bachtiar
 
Analisis Algoritma - Teorema Notasi Asimptotik
Analisis Algoritma - Teorema Notasi AsimptotikAnalisis Algoritma - Teorema Notasi Asimptotik
Analisis Algoritma - Teorema Notasi Asimptotik
Adam Mukharil Bachtiar
 
Analisis Algoritma - Notasi Asimptotik
Analisis Algoritma - Notasi AsimptotikAnalisis Algoritma - Notasi Asimptotik
Analisis Algoritma - Notasi Asimptotik
Adam Mukharil Bachtiar
 
Activity Diagram
Activity DiagramActivity Diagram
Activity Diagram
Adam Mukharil Bachtiar
 
UML dan Use Case View
UML dan Use Case ViewUML dan Use Case View
UML dan Use Case View
Adam Mukharil Bachtiar
 
Materi 8 - Data Mining Association Rule.pdf
Materi 8 - Data Mining Association Rule.pdfMateri 8 - Data Mining Association Rule.pdf
Materi 8 - Data Mining Association Rule.pdf
Adam Mukharil Bachtiar
 
Clean Code and Design Pattern - Meaningful Names
Clean Code and Design Pattern - Meaningful NamesClean Code and Design Pattern - Meaningful Names
Clean Code and Design Pattern - Meaningful Names
Adam Mukharil Bachtiar
 
Data Mining Klasifikasi (Updated 30 Desember 2020)
Data Mining Klasifikasi (Updated 30 Desember 2020)Data Mining Klasifikasi (Updated 30 Desember 2020)
Data Mining Klasifikasi (Updated 30 Desember 2020)
Adam Mukharil Bachtiar
 
Analisis Algoritma - Strategi Algoritma Dynamic Programming
Analisis Algoritma - Strategi Algoritma Dynamic ProgrammingAnalisis Algoritma - Strategi Algoritma Dynamic Programming
Analisis Algoritma - Strategi Algoritma Dynamic Programming
Adam Mukharil Bachtiar
 
Analisis Algoritma - Strategi Algoritma Divide and Conquer
Analisis Algoritma - Strategi Algoritma Divide and ConquerAnalisis Algoritma - Strategi Algoritma Divide and Conquer
Analisis Algoritma - Strategi Algoritma Divide and Conquer
Adam Mukharil Bachtiar
 
Analisis Algoritma - Strategi Algoritma Greedy
Analisis Algoritma - Strategi Algoritma GreedyAnalisis Algoritma - Strategi Algoritma Greedy
Analisis Algoritma - Strategi Algoritma Greedy
Adam Mukharil Bachtiar
 
Analisis Algoritma - Penerapan Strategi Algoritma Brute Force
Analisis Algoritma - Penerapan Strategi Algoritma Brute ForceAnalisis Algoritma - Penerapan Strategi Algoritma Brute Force
Analisis Algoritma - Penerapan Strategi Algoritma Brute Force
Adam Mukharil Bachtiar
 
Analisis Algoritma - Strategi Algoritma Brute Force
Analisis Algoritma - Strategi Algoritma Brute ForceAnalisis Algoritma - Strategi Algoritma Brute Force
Analisis Algoritma - Strategi Algoritma Brute Force
Adam Mukharil Bachtiar
 
Analisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
Analisis Algoritma - Kelas-kelas Dasar Efisiensi AlgoritmaAnalisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
Analisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
Adam Mukharil Bachtiar
 
Analisis Algoritma - Teorema Notasi Asimptotik
Analisis Algoritma - Teorema Notasi AsimptotikAnalisis Algoritma - Teorema Notasi Asimptotik
Analisis Algoritma - Teorema Notasi Asimptotik
Adam Mukharil Bachtiar
 
Analisis Algoritma - Notasi Asimptotik
Analisis Algoritma - Notasi AsimptotikAnalisis Algoritma - Notasi Asimptotik
Analisis Algoritma - Notasi Asimptotik
Adam Mukharil Bachtiar
 

Recently uploaded (20)

Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Alluxio, Inc.
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink TemplateeeeeeeeeeeeeeeeeeeeeeeeeeNeuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Open Source Software Development Methods
Open Source Software Development MethodsOpen Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your wayPlooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized InnovationAdvanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.pptSAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptxMOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration KeySmadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across IndustriesArtificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
AI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | CertivoAI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | Certivo
certivoai
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWSWomen in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
UPDASP a project coordination unit ......
UPDASP a project coordination unit ......UPDASP a project coordination unit ......
UPDASP a project coordination unit ......
withrj1
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdfWhat is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Zoneranker’s Digital marketing solutions
Zoneranker’s Digital marketing solutionsZoneranker’s Digital marketing solutions
Zoneranker’s Digital marketing solutions
reenashriee
 
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
 
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Alluxio, Inc.
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink TemplateeeeeeeeeeeeeeeeeeeeeeeeeeNeuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Open Source Software Development Methods
Open Source Software Development MethodsOpen Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your wayPlooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized InnovationAdvanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.pptSAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptxMOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI SearchAgentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration KeySmadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
Artificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across IndustriesArtificial Intelligence Applications Across Industries
Artificial Intelligence Applications Across Industries
SandeepKS52
 
AI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | CertivoAI-Powered Compliance Solutions for Global Regulations | Certivo
AI-Powered Compliance Solutions for Global Regulations | Certivo
certivoai
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWSWomen in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
UPDASP a project coordination unit ......
UPDASP a project coordination unit ......UPDASP a project coordination unit ......
UPDASP a project coordination unit ......
withrj1
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdfWhat is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
Zoneranker’s Digital marketing solutions
Zoneranker’s Digital marketing solutionsZoneranker’s Digital marketing solutions
Zoneranker’s Digital marketing solutions
reenashriee
 

Algorithm and Programming (Sorting)

  • 1. Adam Mukharil Bachtiar English Class Informatics Engineering 2011 Algorithms and Programming Sorting
  • 2. Steps of the Day Let’s Start Definition of Sorting Bubble Sort Selection Sort
  • 4. WhatisSorting Process that arranges random data into sorted data. Data can be sorted into ascending or descending.
  • 6. Bubble Sort Definition and Structures of Bubble Sort
  • 7. WhatisBubbleSort • Sorting algorithm which was inspired by bubble soap. • Comparing element of array (i) with next element of it (i+1). • If i is bigger than i+1 then swap value of each element.
  • 8. Ilustration of Bubble Sort Array: 5 3 7 9 2 3 6 4 3 1 L. 1 3 5 7 2 3 6 4 3 1 9 L. 2 3 5 2 3 6 4 3 1 7 9 L. 3 3 2 3 5 4 3 1 6 7 9 L. 4 2 3 3 4 3 1 5 6 7 9 L. 5 2 3 3 3 1 4 5 6 7 9 L. 6 2 3 3 1 3 4 5 6 7 9 L. 7 2 3 1 3 3 4 5 6 7 9 L. 8 2 1 3 3 3 4 5 6 7 9 L. 9 1 2 3 3 3 4 5 6 7 9
  • 9. Process of Bubble Sort (Ascending) This is an array that will be sorted in Ascending way: 6 3 9 1 5 Step 1 : 6 3 9 1 5 6 3 9 1 5 6 3 1 9 5 6 1 3 9 5 1 6 3 9 5 j j j j
  • 10. Process of Bubble Sort (Ascending) Step 2 : 1 6 3 9 5 1 6 3 5 9 1 6 3 5 9 1 3 6 5 9 j j j
  • 11. Process of Bubble Sort (Ascending) Step 3 : 1 3 6 5 9 1 3 6 5 9 1 3 5 6 9 Step 4 : 1 3 5 6 9 1 3 5 6 9 Array after sorted in ascending ways: 1 3 5 6 9 j j j
  • 12. General Format for Bubble Sort Ascending 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Procedure BubbleSortAsc(I/O nama_var_array : nama_tipe_array, Input N : integer) {I.S. : array[1..N] sudah terdefinisi} {F.S. : menghasilkan array[1..N] yang tersusun secara ascending} Kamus: i, j : integer temp : tipedata Algoritma: for i  1 to N-1 do for j  n downto i+1 do if(nama_var_array[j] < nama_var_array[j-1]) then temp  nama_var_array[j] nama_var_array[j]  nama_var_array[j-1] nama_var_array[j-1]  temp endif endfor endfor EndProcedure
  • 13. Process of Bubble Sort (Descending) This is an array that will be sorted in Descending way : 6 3 9 1 5 Step 1 : 6 3 9 1 5 6 3 9 1 5 6 9 3 1 5 6 9 3 1 5 6 9 3 5 1 j j j j
  • 14. Process of Bubble Sort (Descending) Step 2 : 6 9 3 5 1 9 6 3 5 1 9 6 3 5 1 9 6 5 3 1 j j j
  • 15. Process of Bubble Sort (Descending) Step 3 : 9 6 5 3 1 9 6 5 3 1 9 6 5 3 1 Step 4 : 9 6 5 3 1 9 6 5 3 1 Array after sorted in descending ways: 9 6 5 3 1 j j j
  • 16. General Format for Bubble Sort Descending 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Procedure BubbleSortDesc (I/O nama_var_array : nama_tipe_array, Input N : integer) {I.S. : array[1..N] sudah terdefinisi} {F.S. : menghasilkan array[1..N] yang tersusun secara descending} Kamus: i,j : integer temp : tipedata Algoritma: for i  1 to N-1 do for j  1 to (N - i) do if(nama_var_array[j] < nama_var_array[j+1]) then temp  nama_var_array[j] nama_var_array[j]  nama_var_array[j+1] nama_var_array[j+1]  temp endif endfor endfor EndProcedure
  • 17. Selection Sort Definition and Structures of Selection Sort
  • 18. WhatisSelectionSort Sorting algorithm that arranges random data by selecting the biggest data or the smallest one.
  • 20. Process of Maximum Sort (Ascending) This is an array that will be sorted in Ascending way : 6 3 9 1 5 Step 1 : 6 3 9 1 5 6 3 9 1 5 6 3 9 1 5 6 3 9 1 5 6 3 9 1 5 6 3 5 1 9 j j j jmax max max max max j
  • 21. Process of Maximum Sort (Ascending) Step 2 : 6 3 5 1 9 6 3 5 1 9 6 3 5 1 9 6 3 5 1 9 1 3 5 6 9 j j jmax max max max j
  • 22. Process of Maximum Sort (Ascending) Step 3 : 1 3 5 6 9 1 3 5 6 9 1 3 5 6 9 1 3 5 6 9 Step 4 : 1 3 5 6 9 1 3 5 6 9 Array after sorted in descending way: 1 3 5 6 9 j j max max max max j j max
  • 23. General Format for Maximum Sort Ascending 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Procedure MaximumSortAsc(I/O nama_var_array : nama_tipe_array, Input N : integer) {I.S. : array [1..N] sudah terdefinisi} {F.S. : menghasilkan array [1..N] yang tersusun secara ascending} Kamus: i, j, max, x : integer temp : tipedata Algoritma: x  n for i  1 to N-1 do max  1 for j  2 to x do if(nama_var_array[j] > nama_var_array[max]) then max  j endif endfor temp  nama_var_array[max] nama_var_array[max]  nama_var_array[j] nama_var_array[j]  temp x  x - 1 endfor EndProcedure
  • 24. General Format for Minimum Sort Ascending 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Procedure MinimumSortAsc(I/O nama_var_array : nama_tipe_array, Input N : integer) {I.S. : array[1..n] sudah terdefinisi} {F.S. : menghasilkan array [1..n] yang tersusun secara ascending} Kamus: i, j, min : integer temp : tipedata Algoritma: for i  1 to (N – 1) do min  i for j  i+1 to N do if(nama_var_array[j] < nama_var_array[min]) then min  j endif endfor temp  nama_var_array[min] nama_var_array[min]  nama_var_array[i] nama_var_array[i]  temp endfor EndProcedure
  • 25. Contact Person: Adam Mukharil Bachtiar Informatics Engineering UNIKOM Jalan Dipati Ukur Nomor. 112-114 Bandung 40132 Email: [email protected] Blog: http://adfbipotter.wordpress.com Copyright © Adam Mukharil Bachtiar 2011