2. [Multistage Graph] Carilah jalur terpendek dari node A ke node J pada multistage graph
dibawah menggunakan metode dynamic programming (pendekatan forward dan backward)!
1
D G
3 4
7
B 4
5 6
3 3
E H
A J
5 4 2
3
C 8 6 3
F 3 I
3. [Travelling Salesman Problem] Carilah jalur terpendek dari Supe mengunjungi Luhu, Piru,
dan Kairatu dan kembali ke Supe jika diketahui biaya transportasi sebagai berikut
menggunakan metode dynamic programming.
From To Cost
This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:28:14 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/84239152/TP-2-Algorithm-V2docx/
Supe Luhu Rp. 20.000
4. [Coin Change Problem] Carilah kombinasi jumlah pecahan uang maksimum yang dapat
dibentuk dari nominal uang 47 dimana pecahan nominal uang adalah 2, 3, dan 7!
This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:28:14 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/84239152/TP-2-Algorithm-V2docx/
Jawaban
1).
W=
V 1 2 3 4 5 6 7 8 9 10 11 12 13
0
i=
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0
372 412 458 784 784 870 1242 1242 1242 1242 1242
3 0 0 8700
0 0 0 0 0 0 0 0 0 0 0
372 412 458 784 798 870 1242 1256 1256 1256 1256
4 0 0 11700
0 0 0 0 0 0 0 0 0 0 0
This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:28:14 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/84239152/TP-2-Algorithm-V2docx/
14 15 16 17 18 19
0 0 0 0 0 0
… … … … … …
… … … … … …
2140
… … … … …
5
Weight = 18
2).
1
D G
3 4
7
B 4
5 6
3 3
E H
A J
5 4 2
3
C 8 6 3
F 3 I
Forward
Cost (4,G) = 7
Cost (4,H) = 3
Cost (4,I) = 3
This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:28:14 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/84239152/TP-2-Algorithm-V2docx/
Cost (3,F) = H+J | I+J = 6+3 | 3+3 = 6 (I,J)
Backward
Cost (2,B) = 5
Cost (2,C) = 3
3).
This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:28:14 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/84239152/TP-2-Algorithm-V2docx/
Supe 20 15 25
Luhu 19 21 27
Piru 18 12 15
Kairatu 16 17 16
C (S,L) = 20
C (S,P) = 15
C (S,K) = 25
C (S,L,K) = 20 + 27 = 47
C (S,L,P) = 20 + 21 = 41
C (S,P,L) = 15 + 12 = 27
C (S,P,K) = 15 + 15 = 30
C (S,K,L) = 25 + 17 = 42
C (S,K,P) = 25 + 16 = 41
C (S,L,K,P) | C (S,K,L,P) = 47 + 16 | 42 + 21 = 63 S = 63 + 18 = 81
C (S,L,P,K) | C (S,P,L,K) = 41 + 15 | 27 + 27 = 54 S = 54 + 16 = 70
C (S,P,K,L) | C (S,K,P,L) = 30 + 17 | 41 + 12 = 47 S = 47 + 19 = 66
This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:28:14 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/84239152/TP-2-Algorithm-V2docx/
Referensi : LN
4).
1
0 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20
0
1 0 1 2 1 1 3 2 1 4 3 2 5 4 3 5 5 4 7 6 6
2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3
30 40
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
9 7 7 11 9 9 1 1 1 15 1 1 1 1 1 1 1 1 2 22
3 2 0 4 3 7 7 5 9 9 8 2
4 4 4 4 4 4 4
1 2 3 4 5 6 7
2 2 2 2 2 2 2
1 5 4 4 8 8 7
Kembalian = 2,3,7
Totalnya 27 kombinasi
This study source was downloaded by 100000838835617 from CourseHero.com on 09-19-2022 19:28:14 GMT -05:00
COMP6127 - Algorithm Design and Analysis
https://www.coursehero.com/file/84239152/TP-2-Algorithm-V2docx/
Powered by TCPDF (www.tcpdf.org)