You are on page 1of 4

JAWABAN UAS MATA KULIAH ALGORTIMA STRUKTUR DATA

FAHRUL SANJAYA (2103197078)


1. Algortima Warshall

- A0
1 2 3 4
1 0 8 Inf 1
2 inf 0 1 Inf
3 4 Inf 0 Inf
4 Inf 2 9 0
- A1
1 2 3 4
1 0 8 Inf 1
2 inf 0 1 Inf
3 4 12 0 5
4 Inf 2 9 0
Rute: 3-1-4 = 5
3-1-2 = 12
- A2
1 2 3 4
1 0 8 9 1
2 inf 0 1 Inf
3 4 12 0 5
4 Inf 2 9 0
Rute: 1-2-3 = 9
- A3
1 2 3 4
1 0 8 9 1
2 5 0 1 6
3 4 12 0 5
4 7 2 3 0
Rute: 2-3-1-4 = 6
4-2-3-1 = 12
- A4
1 2 3 4
1 0 3 4 1
2 5 0 1 6
3 4 7 0 5
4 7 2 3 0
Rute: 1-4-2 = 3
2. Binary Search

0 1 2 3 4 5 6 7 8 9
2 3 5 7 8 10 12 15 18 20
Dibagi 2 dengan mengambil tengah-tengah
L=0
0 1 2 3 4 5 6 7 8 9
2 3 5 7 8 10 12 15 18 20
L=3 M=5 H=7
7<8

0 1 2 3 4 5 6 7 8 9
2 3 5 7 8 10 12 15 18 20
L=3 M=5 H=7
5>7 H=7
0 1 2 3 4 5 6 7 8 9
2 3 5 7 8 10 12 15 18 20
3. Bubble Sort

I=0
1 5 6 2 4 3
I=1
1 5 2 6 4 3
I=
1 2 5 4 6 3
I=3
1 2 4 5 6 3
I=4
1 2 4 5 3 6
I=5
1 2 4 3 5 6
I=6
1 2 3 4 5 6
4. ilustrasi penelusuran elemen pada binary Tree

a. Pre Order
A-B- D- C- E- G-F-H- I
b. In Order
D- B- A- G- E- C- H- F- I
c. Post Order
D- G- H- I- E- F- B- C- A

You might also like