Monday, 13 July 2015

Trees and Graphs Basics

So let's have an intro into some of the type of trees

Just a brief idea:

Binary Tree: It's just a tree with at most 2 child nodes.

Binary Search Tree: Nodes to the left are less than the current node and nodes to the right are larger than the current node.

Balanced Tree : It's a tree that keeps its height in check or to a minimum.

Unbalanced Tree : It's a tree in which its height isn't kept in check. Eg. A node having a right node which has a right node etc.

Full tree: All nodes have either 2 child nodes or is a leaf node.

Complete tree: All nodes except the last level are complete, and the nodes of the last level have all its nodes to the left.

Traversal

Preorder: Root,Left,Right

Inorder:Left,Root,Right

Postorder: Left,Right,Root




No comments:

Post a Comment