Lecture 8 Tree. Tree. Tree: Tree is a connected graph with no cycle Theorem: Let G be graph with more than one vertex. Then the following are equivalence: 1) G is a tree. 2) G is cycle-free with (n-1) edges.
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Tree is a connected graph with no cycle
Let G be graph with more than one vertex. Then the following are equivalence:
1) G is a tree.
2) G is cycle-free with (n-1) edges.
3) G is connected and has (n-1) edges. (i.e: if any edge is deleted then the resulting graph is not connected)
A rooted tree R consists of a tree graph together with vertex r called the root of the tree. ( is a directed tree where all arrows are directed a way from a single vertex)
Height or depth: The number of levels of a tree
Leaves: The vertices of the tree that have no child (vertices with degree one)
Degree of tree: The largest number of children in the vertices of the tree
Binary tree : every vertex has at most 2 children
Order Rooted Tree (ORT): Whenever draw the digraph of a tree, we assume some ordering at each level, by arranging children from left to right.
Or ; is a binary tree such that the set of children of each parent is linearly ordered from left to right.
Any algebraic expression involving binary operations +, -, , ÷ can be represented by an order rooted tree (ORT)
the binary rooted tree for a+b is :
The variable in the expression a & b appear as leaves and the operations appear as the other vertices.
Polish notation (Binary Tree Traversal Algorithm):
The polish notation form of an algebraic expression represents the expression unambiguously with out the need for parentheses
1) In order LOR (infix) : a + b
2) Pre order OLR(prefix) : + a b
3) Post order LRO (postfix) : a b +
example 1: infix polish notation is : a + b
prefix polish notation : + a b
example 2: infix polish notation is : a + 2 * b
prefix polish notation : + a * 2 b
Example5: according to the following digraph , ÷ can be represented by an order rooted tree (ORT)
Post order : 188.8.131.52.184.108.40.206
Pre order : 220.127.116.11.18.104.22.168
In order : 22.214.171.124.126.96.36.199