Sorting (Bab 8)
Informatics Engineering Department
TRUNOJOYO UNIVERSITY
SORTING / PENGURUTAN DATA
Struktur Data
KLASIFIKASI KE-1
Berdasarkan perbandingan
(comparison-based sorting).
KLASIFIKASI KE-2
Berdasarkan prioritas antrian
(priority queue sorting method).
KLASIFIKASI KE-3
Berdasarkan penyisipan dan
penjagaan terurut (insert and keep sorted
method).
KLASIFIKASI KE-4
Berdasarkan pembagian dan
penguasaan (devide and conquer method).
- pengurutan cepat (quick sort)
- pengurutan gabung (merge sort)
SORTING
KLASIFIKASI KE-5
Berdasarkan pengurutan berkurang
menurun (diminishing increment sort method).
- pengurutan shell (shell sort)
BUBLE SORT
PASS PERTAMA
BUBLE SORT
PASS KEDUA
BUBLE SORT
PASS KETUJUH
BUBLE SORT
Kamus
ALGORITMA
Const N : integer = 8 { misalkan jumlah elemen array maksimum = 8 }
Type A = array [ 1..N ] of integer
Var I, J, bubble : integer
ALGORITMA
For I 1 to (N-1) do
For J N downto (I+1) do
If A[J] < A[J-1] then
Bubble A[J]
A[J] A[J-1]
A[J-1] Bubble
Endif
Endfor
Endfor
SELECTION SORT
CONTOH
SELECTION SORT
CONTOH
INSERTION SORT
CONTOH