1

Im doing a research about binary trees and there is a question I couldn't find the answer to. Can a root in a binary tree have zero children? Like if we had a tree containing only one node (the root) can we call it a binary tree?

salma
  • 13
  • 7
  • I guess in theory the answer is yes if you have implemented a binary tree data structure and instantiated it only with the root. Also, the binary tree may get insulted if you don't call him by it's self determined type, just because she is without children! – Manu Oct 20 '21 at 16:34
  • Does this answer your question? [Can a tree node be both a root node and a leaf node?](https://stackoverflow.com/questions/36321416/can-a-tree-node-be-both-a-root-node-and-a-leaf-node) – trincot Oct 20 '21 at 19:09

1 Answers1

0

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.

With this concept:

Examples of tree

Because in case 2, the tree have two null childs.