Data-structure – Ordered Tree vs Unordered Tree

A binary tree can be ordered or an unordered tree, so what is the difference between these two trees. In this lesson, you will compare ordered tree vs. unordered tree and tell the difference.

Ordered Tree Example

The name suggest that the ordered tree must be an organized tree in which nodes are in some order. What is the common ordering method?

An Ordered Tree - ordered tree vs. unordered tree
An Ordered Tree

In the figure above, for any node, its left child has less value than the node itself and the right child has value greater than the node.

Unordered Tree

In a binary tree, when nodes are not in a particular order it is called an unordered tree.

See the root, all the left descendants of root are less than the root value and all right descendant has value greater than the root.

 

Unordered Tree - ordered tree vs. unordered tree
Unordered Tree

This is the primary difference between ordered tree vs. unordered tree.


Bibliography

R.G.Dromey. 2008. How to Solve it by Computer. Pearson Education India.

Robert Kruse, Cl Tondo. n.d. Data Structures and Program Design in C. Pearson Education India.

Thomas H. Cormen, Charles E. Leiserson, Ronald Rivest, Clifford Stein. 2009. Introduction to Algorithms. MIT Press.

 

Advertisements