Pohon biner di mana setiap simpul memiliki maksimal dua anak (kiri dan kanan).
Konsep Kunci Binary Trees:
Pelajari sintaks di bawah, pahami alur eksekusi logika interpreter Python, dan uji secara langsung di Code Lab Skillance Academy.
Pohon biner di mana setiap simpul memiliki maksimal dua anak (kiri dan kanan).
Pelajari sintaks di bawah, pahami alur eksekusi logika interpreter Python, dan uji secara langsung di Code Lab Skillance Academy.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
body {
font-family: 'Fira Code', Consolas, Monaco, monospace;
background: #0f172a;
color: #f8fafc;
padding: 20px;
margin: 0;
line-height: 1.6;
}
.header {
background: #1e293b;
padding: 10px 16px;
border-radius: 8px 8px 0 0;
border-bottom: 2px solid #334155;
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: #94a3b8;
}
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-red { background: #ef4444; }
.dot-yellow { background: #eab308; }
.dot-green { background: #22c55e; }
.code-box {
background: #1e293b;
padding: 18px 20px;
border-bottom: 1px dashed #334155;
color: #38bdf8;
font-size: 14px;
white-space: pre-wrap;
}
.keyword { color: #f43f5e; font-weight: bold; }
.comment { color: #64748b; font-style: italic; }
.string { color: #4ade80; }
.number { color: #fca311; }
.output-box {
background: #020617;
padding: 18px 20px;
border-radius: 0 0 8px 8px;
color: #e2e8f0;
font-size: 13px;
}
.prompt { color: #fca311; font-weight: bold; }
</style>
</head>
<body>
<div class="header">
<span class="dot dot-red"></span>
<span class="dot dot-yellow"></span>
<span class="dot dot-green"></span>
<span style="margin-left: 8px; font-weight: bold; color: #38bdf8;">Binary Trees - Skillance Python 3.12</span>
</div>
<div class="code-box">
<span class="comment"># Skrip Python - Skillance Academy Indonesia</span>
class TNode: def __init__(self, v): self.v = v; self.l = None; self.r = None
root = TNode(10); root.l = TNode(5)
print('Root:', root.v, '| Anak Kiri:', root.l.v)
</div>
<div class="output-box">
<div style="color: #64748b; margin-bottom: 6px;">[Terminal Output] > python main.py</div>
<div style="color: #4ade80; font-weight: bold;">Root: 10 | Anak Kiri: 5</div>
</div>
</body>
</html>
Uji skrip Python untuk topik Binary Trees di atas dan amati hasil eksekusi terminalnya secara instan.