In computer science, a binary tree is a Tree Data structure in which each node has at most two children, which are referred to as the left child and the right child.

(“Binary Tree” 2022)

Types

Implementation

Representations

Array

Indexing

Assuming a 0-indexed array: child nodes for a node at index \(i\) are at \(\text{left}=2i+1\) and \(\text{right}=2i+2\). Similarly, the parent node for a node at index \(i\) is at \(\lfloor\frac{i-1}{2}\rfloor\).

References