Sabtu, 09 Januari 2016
tugas tambahan
PERTEMUAN 14
Misalterdapat 8 orang mahasiswa (1, 2, 3, 4, 5, 6, 7, 8)
• dan lima buahmatakuliah yang dipilih (A, B, C, D, E).
• Matriksberikutmenunjukkanmahasiswaimengambilmata
kuliah j.
Ketentuansoal
• Buatlahpenjadwalan agar mahasiswadapat
mengikutiujian..
JAWABAN :
Keterangan :
H=HIJAU
P=PINK
M=MERAH
• WarnaMerah :untuksimpul B,D
• WarnaPink : untuksimpul A,E
• WarnaHijau : untuksimpul C (dikarenakan
berdampingan)
• Simpul C bertetanggadengansimpul A (warna
pink), dansimpul D (warnamerah) sehingga C
harusdiberiwarna lain.
PERTEMUAN 13
1. Buatlah Shortest Path Problem untuk graph dibawahini !
JAWABAN :
Jalur A-D
. A-D = 55
. A-B-C-D = 25 + 45 + 35 = 105
Jalurterpendekuntuksimpul A ke D = 55
Jalur A-C
. A-B-C = 25 + 45 = 70
. A-D-B-C = 55 + 5 + 45 = 105
Jalurterpendekuntuksimpul A ke C = 70
Jalur A-B
. A-B = 25
. A-D-B = 55 + 5 = 60
Jalurterpendekuntuksimpul A ke B = 25
Jalur A-E
. A-E = 15
. A-B-C-D-E = 25 + 45 + 35 + 20 = 125
. A-D-E = 55 + 20 = 75
Jalurterpendekuntuksimpul A ke E = 15
NO JALUR JARAK
1 A-D 55
2 A-B-C 70
3 A-B 25
4 A-E 15
LATIHAN
2.
JAWABAN :
JALUR JARAK
A-E 1.2
A-F 1.8
F-D 1.9
D-E 2.0
D-B 2.1
B-C 1.8
B-E 2.2
E-C 2.4
D-C 2.4
C-A 2.5
A-B 2.6
A-D 2.7
C-F 2.8
F-E 3.0
F-B 3.2
SOAL LATIHAN :
Terdapatmobilangkutandengankapasitasmuatan 255 kg. Seseorangpetaniakanmembawahasilpertaniannyakekotadenganbarangsebagaiberikut.
1. Wortel 20 kg = 1 Juta
2. Beras 150 kg = 2 Juta
3. Mangga 100 kg = 1,5 Juta
4. Sayuran 50 kg = 1,2 Juta
5. Bawang 50 kg = 1,2 Juta
Tentukanurutanbarang yang dibawapetani agar optimal.
Jawaban :
P 150 100 50 50 20
W 2 1/5 1/2 1 1
1. Profit = 2, 3, 5, 4, 1
= ( 0, 1, 1, 0, 1/10 )
2. Weight = 1, 4, 5, 3, 2
= ( 1, 7/10, 1, 1, 1 )
3. Density = 1, 5, 4, 3, 2
= ( 1, 1/70, 1, 1, 1 )
2. X2 + W3.X3 + W5.X5 + W4.X4 + W1.X1 = 255
150.1 + 100.1 + 50.X5 + 0 + 0 = 255
50.X5 = 255 – 250
X5 = 5/50 = 1/10
3. X1 + W4.X4 + W5. X5 + W3.X3 + W2.X2 = 255
20.1 + 50.1 + 50.1 + 100.1 + 150.X2 = 255
150.X2 = 255 – 220
X2 = 35/150 = 7/30
4. X1 + W5.X5 + W4.X4 + W3.X3 + W2.X2 =255
20.1 + 50.1 + 50.1 + 100.1 + 150.X2 = 255
150.X2 = 255 – 220
150.X2 = 35
X.2 = 35/150 = 7/30
5.
PERTEMUAN 10
44, 55, 12, 12, 42, 94, 18, 6, 67
TentukandenganMenggunakan..
1. Metode Selection Sort
2. Metode Bubble Sort
3. Metode Merge Sort
4. Metode Quick Sort
5. Metode Insertion
Jawaban :
1. Metode Selection Sort
44, 55, 12, 12, 42, 94, 18, 6, 67
Langkah 1 =44, 55, 12, 12, 42, 94, 18, 6, 67
Langkah 2=6, 55, 12, 12, 42, 94, 18, 44, 67
Langkah 3=6, 18, 12, 12, 42, 94, 55, 44, 67
Langkah 4=6, 18, 12, 12, 42, 94, 55, 44, 67
Langkah 5=6, 12, 12, 18, 42, 94, 55, 44, 67
Langkah 6=6, 12, 12, 18, 42, 94, 55, 44, 67
Langkah 7=6, 12, 12, 18, 42, 67, 55, 44, 94
Langkah 8=6, 12, 12, 18, 42, 44, 55, 67, 94 === hasilnya
2. Metode Bubble Sort
44, 55, 12, 12, 42, 94, 18, 6, 67
Interasi 1 a= 44, 55, 12, 12, 42, 94, 6, 18, 67
b= 44, 55, 12, 12, 42, 6, 94, 18, 67
c= 44, 55, 12, 12, 6, 42, 94, 18, 67
d= 44, 55, 12, 6, 12, 42, 94, 18, 67
e= 44, 55, 6, 12, 12, 42, 94, 18, 67
f= 44, 6, 55, 12, 12, 42, 94, 18, 67
g= 6, 44, 55, 12, 12, 42, 94, 18, 67
interasi 2a= 6, 44, 55, 12, 12, 42, 18, 94, 67
b= 6, 44, 55, 12, 12, 18, 42, 94, 67
c= 6, 44, 55, 12, 18, 12, 42, 94, 67
d= 6, 44, 55, 18, 12, 12, 42, 94, 67
e= 6, 44, 18, 55, 12, 12, 42, 94, 67
f= 6, 18, 44, 55, 12, 12, 42, 94, 67
interasi 3a= 6, 18, 44, 55, 12, 12, 42, 94, 67
b= 6, 18, 44, 55, 12, 12, 42, 94, 67
c= 6, 18, 44, 12, 55, 12, 42, 94, 67
d= 6, 18, 12, 44, 55, 12, 42, 94, 67
e= 6, 12, 18, 44, 55, 12 ,42, 94, 67
interasi 4a= 6, 12, 18, 44, 55, 12, 42, 94, 67
b= 6, 12, 18, 44, 12, 55, 42, 94, 67
c= 6, 12, 18, 12, 44, 55, 42, 94, 67
d= 6, 12, 12, 18, 44, 55, 42, 94, 67
interasi 5a= 6, 12, 12, 18, 44, 55, 42, 94, 67
b= 6, 12, 12, 18, 44, 42, 55, 94, 67
c= 6, 12, 12, 18, 42, 44, 55, 94, 67
interasi 6a= 6, 12, 12, 18, 42, 44, 55, 94, 67
b= 6, 12, 12, 18, 42, 44, 55, 67, 94
interasi 7= 6, 12, 12, 18, 42, 44, 55, 67, 94 == hasil
3. Metode Quick Sort
4 55 12 12 42 94 18 6 67
JAWBAN :
44 55 12 12 42 94 18 6 67
12 12 42 18 6 44 55 94 67
6 12 12 42 18 44 55 67 94
6 12 12 18 42 44 55 67 94
6 12 12 18 42 44 55 67 94
4. Metode Insertion Sort
44 55 12 12 42 94 18 16 6 67
JAWAB :
Langkah 1 : 44 55 12 12 42 94 18 6 67
Langkah 2 : 55 44 12 12 42 94 16 6 67
Langkah 3 : 12 55 44 12 42 94 18 6 67
Langkah 4 : 12 44 55 12 42 94 18 6 67
Langkah 5 : 12 12 44 55 42 94 18 6 67
Langkah 6 : 12 12 42 44 55 94 18 6 67
Langkah 7 : 12 12 18 42 44 55 94 6 67
Langkah 8 : 6 12 12 18 42 44 55 94 67
Langkah 9 : 6 12 12 18 42 44 55 67 94
5. Merge Sort
44 55 12 12 42 94 18 16 6 67
Langkah 1 44 55 12 12 42 94 18 16 6 67
Langkah 2 44 55 12 12 42 94 18 16 6 67
Langkah 3 12 44 55 12 42 16 18 94 6 67
Langkah 4 12 44 55 12 42 16 18 94 6 67
Langkah 5 6 12 12 16 18 42 44 55 67 94
Langganan:
Postingan (Atom)