A girl and a robot thinking together

Think together · Start with a little story

The girl asks each task to split into at most two subtasks: a left one and a right one. Why is this structure called a binary tree?

Lay out the process

Follow the steps, then explain them in your own words
  1. Root nodeA starting point
  2. Left childMay be present or absent
  3. Right childMay be present or absent

Each node in a binary tree has at most two children, called left and right.

“At most two” allows zero or one; a node does not need to branch twice.

01What is a binary tree?

A binary tree is a tree in which each node has at most two child nodes.

A
BC

02What are the two children called?

Left child

left child

Right child

right child

Even if a node has only one child, that child is still identified as either its left child or its right child.

03Does “binary” mean every node has two children?

No.

0 children

Allowed; the node is a leaf.

1 child

Allowed.

2 children

Also allowed.

A node simply cannot have more than two children.

04Is a binary tree the same as a binary search tree?

No.

A binary search tree (BST) is a special kind of binary tree with an additional ordering rule for its keys.

05Why do binary trees work well with recursion?

Below a node in a binary tree, there are two smaller binary trees:

Current node + left subtree + right subtree

This matches the idea you learned earlier: break a problem into smaller problems of the same kind.

06How do you traverse a binary tree?

Common traversal orders include:

Preorder

Root → Left → Right

Inorder

Left → Root → Right

Postorder

Left → Right → Root

There is also level-order traversal, which visits nodes one level at a time and usually uses a queue.

What have you learned?

  • Each node in a binary tree has at most two children.
  • The children are called left and right.
  • A node does not need to have exactly two children.
  • A binary tree and a binary search tree are different concepts.
  • Binary trees have a natural recursive structure.

Next: What is a graph?

Your turn to try

Can a tree with only one node be a binary tree?

Ready? Open to see the explanation

Yes. It has zero children, which is no more than two, and it does not break the left-right position rule.