What is Binary Tree?

Technology CommunityCategory: Data StructuresWhat is Binary Tree?
VietMX Staff asked 3 years ago

A normal tree has no restrictions on the number of children each node can have. A binary tree is made of nodes, where each node contains a “left” pointer, a “right” pointer, and a data element.

There are three different types of binary trees:

  • Full binary tree: Every node other than leaf nodes has 2 child nodes.
  • Complete binary tree: All levels are filled except possibly the last one, and all nodes are filled in as far left as possible.
  • Perfect binary tree: All nodes have two children and all leaves are at the same level.

binary-tree