Tutorial 6 Graph and Trees

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Tutorial 6 : Graphs & Trees 1. For each of the following, each relation R is defined on the set A.

In each case determine if R is a rooted tree and if it is, find the root. a. A= { a, b, c, d, e } , R = { (a,d), (b,c), (c, a), (d, e)} b. A= { a, b, c, d, e, f } , R = { (a, b), (c, e), (f, a), (f, c), ( f, d) } c. A= { 1, 2, 3, 4, 5, 6 } , R = {(2, 1), (2, 3), (3, 4), (4, 5), (4, 6)} 2. Given a tree such of the following: u s k a m v z

By referring to the above tree, answer the following: a. What is the height of the tree? b. Name all the leaves. c. Name the ancestors of m. 3. Construct a binary tree for the data set: low humidity and sunshine are sufficient for me to play tennis this afternoon

4. a. Construct a binary tree for the data set; Fatihah Zumar Maidah Baqarah Naml Luqman Muminuun Yasin b. By using the tree, list the names of the surah found when searching for surah Isra

c. d. 4.

Name the descendants of al-Maidah Insert the surah Yusuf into the tree.

Calculate the height of a full binary tree that has 63 nodes.

5.

Construct a binary expression tree for the following expressions: a. (a * b ) - ( c + d). b. (a b) * (c/(d + e))

Construct a binary tree for the following data set: a. If you want to reach the stars, aim for the sky. i. insert the word planet into the tree. ii. list the word found when searching for the word comet b. 99, 100, 87, 65, 43, 89, 120, 34. i. insert number 77 into the tree. ii. List the numbers found when searching for the number 55.

6.

You might also like