Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between "Complete binary tree", "strict binary tree","full binary Tree"?

I am confused about the terminology of the below trees, I have been studying the Tree, and I am unable to distinguish between these trees:

a) Complete Binary Tree

b) Strict Binary Tree

c) Full Binary Tree

Please help me to differentiate among these trees. When and where these trees are used in Data Structure?

like image 599
kTiwari Avatar asked Sep 10 '12 21:09

kTiwari


People also ask

What is the difference between complete binary tree and strict binary tree?

Full/ proper/ strict Binary treeThe full binary tree is also known as a strict binary tree. The tree can only be considered as the full binary tree if each node must contain either 0 or 2 children. The full binary tree can also be defined as the tree in which each node must contain 2 children except the leaf nodes.

What is a strict binary tree?

A strictly binary tree with n leaves always contains 2n -1 nodes. If every non-leaf node in a binary tree has nonempty left and right subtrees, the tree is termed a strictly binary tree. Or, to put it another way, all of the nodes in a strictly binary tree are of degree zero or two, never degree one.

Can complete binary tree be full binary tree?

It is not a full binary tree as node 2 has only one child. The binary tree which is shown below is a complete as well as a full binary tree. It is a complete binary tree as all the nodes are left filled. It is a full binary tree as all the nodes have either 0 or 2 children.


1 Answers

Perfect Tree:

       x      /   \     /     \    x       x   / \     / \  x   x   x   x / \ / \ / \ / \ x x x x x x x x 

Complete Tree:

       x      /   \     /     \    x       x   / \     / \  x   x   x   x / \ / x x x 

Strict/Full Tree:

       x      /   \     /     \    x       x   / \   x   x      / \     x x  
like image 186
japreiss Avatar answered Oct 01 '22 21:10

japreiss