LATIHAN STRUKTUR DATA | PERTEMUAN 10
Soal!
Buatlah pohon biner dari barisan bilangan berikut:
1. 12, 22, 8, 19, 10, 9, 20, 4, 2, 6
2. 2, 3, 4, 5, 50, 10, 15, 13, 20, 12, 10, 7
3. 7, 13, 4, 6, 5, 9, 15, 20, 60, 14, 40, 70
4. 50, 45, 55, 41, 49,13,60, 70, 40, 35, 30, 20, 80, 75, 85
5. 12, 19, 11, 17, 29, 21, 20, 22, 13, 14, 18, 16, 15
Jawaban!
1. 12, 22, 8, 19, 10, 9, 20, 4, 2, 6
12
/ \
8 22
/ \ /
4 10 19
/ / /
2 9 20
/
6
2. 2, 3, 4, 5, 50, 10, 15, 13, 20, 12, 10, 7
2
\
3
\
4
\
5
\
50
/
10
/ \
7 15
/ \
13 20
/
12
\
10
3. 7, 13, 4, 6, 5, 9, 15, 20, 60, 14, 40, 70
7
/ \
4 13
\ / \
6 9 15
/ \
5 14
\
20
/ \
60 40
\
70
4. 50, 45, 55, 41, 49,13,60, 70, 40, 35, 30, 20, 80, 75, 85
50
/ \
45 55
/ \ / \
41 49 60 70
/ / \
13 40 80
\
75
\
85
\
30
/
20
5. 12, 19, 11, 17, 29, 21, 20, 22, 13, 14, 18, 16, 15
12
/ \
11 19
/ \
17 21
/ \
20 29
/ / \
13 22 18
\ /
14 16
\
15
Komentar
Posting Komentar