Bináris fa (Binary tree)

  • csúcs indexe: $i$
  • csúcs bal gyereke: $2 \cdot i + 1$
  • csúcs jobb gyereke: $2 \cdot i + 2$
  • csúcs szülője: $\lfloor \frac{i - 1}{2} \rfloor$
  • hanyadik szinten van a csúcs: $\lfloor log_{2} \space (i + 1) \rfloor$

Animáció

Struktogram

$preorder(t : Node^*)$


$t \neq \emptyset$

$process(t)$ $\text{SKIP}$
$preorder(t \rightarrow left)$
$preorder(t \rightarrow right)$

$inorder(t : Node^*)$


$t \neq \emptyset$

$inorder(t \rightarrow left)$ $\text{SKIP}$
$process(t)$
$inorder(t \rightarrow right)$

$postorder(t : Node^*)$


$t \neq \emptyset$

$postorder(t \rightarrow left)$ $\text{SKIP}$
$postorder(t \rightarrow right)$
$process(t)$

Feladatok