Utshaw
Utshaw

Reputation: 4276

Classification of Binary Tree

I have heard various kinds of Binary Tree . (i.e. Full, Complete ,Perfect ,Balanced)
My assumption:
1) Full binary tree : Every nodes except the leaves will have 2 children
2) Complete binary tree: May be same as Full binary tree
3) Perfect binary tree: I don't have any idea
4) Balanced binary tree: For each node , number of nodes in left sub-tree is roughly equal to the number of nodes in right sub-tree.
What are the correct definitions for these varius kinds of binary trees?

Upvotes: 0

Views: 277

Answers (1)

Reyomi
Reyomi

Reputation: 263

Those are types of binary trees:

  • Full Binary Tree: A full binary tree is a special type of binary tree in which every parent node/internal node has either two or no children. It is also known as a proper binary tree.
  • Degenerate Tree: A degenerate or pathological tree is a tree having a single child either left or right. Such trees are performance-wise the same as linked lists.
  • Skewed Binary Tree: A skewed binary tree is a pathological/degenerate tree in which the tree is either dominated by the left nodes or the right nodes. Thus, there are two types of skewed binary trees: left-skewed binary trees and right-skewed binary trees.
  • Complete Binary Tree: A Binary Tree is a Complete Binary Tree if all the levels are completely filled except possibly the last level and the last level has all keys as left as possible. A complete binary tree is just like a full binary tree, but with two major differences: Every level except the last level must be completely filled. All the leaf elements must lean towards the left.
  • Perfect Binary Tree: A Binary tree is a Perfect Binary Tree in which all the internal nodes have two children and all leaf nodes are at the same level. The number of leaf nodes is the number of internal nodes plus 1.
  • Balanced Binary Tree: A balanced binary tree, also known as a height-balanced binary tree, is defined to be a binary tree in which the height of the left and right subtree of any node differ by not more than 1.

Upvotes: 1

Related Questions