...

/

Introduction to Binary Trees

Introduction to Binary Trees

Let’s learn about the various types of binary trees.

Binary tree

As we discussed earlier, a binary tree is a type of tree in which each node has at most two children, which means a node in the binary tree can have one, two, or no children. These children are referred to as the left child and the right child.

The above diagram shows a node of the binary tree with a stored as data and whose left child and right child both pointing to null.

We can code the above node as follows:

type Node struct {
...