You are on page 1of 4

Universiti Teknologi Petronas

SMB2033 Discrete Mathematics (Jan 2008)

Tutorial 9 Dijkstra Shortest-Path Algorithm and Trees 1. Find the length of the shortest path between these pairs of vertices ( a and f) in the weighted graph below:

The shortest path is a, c, d , f with the length = 11. (Draw different diagram foe ea h iteration!. 2. Find a route with the least total airfare that visits each of the cities in this graph, where the weight on an edge is the least price available for a flight between the two cities.

"e see that the ir uit

has the minimum total weight 11#$


1

3. Which of these graphs are trees

4.

nswer the !uestions about the rooted tree illustrated. a. Which verte" is the root# b. Which vertices are internal# c. Which vertices are leaves# d. Which vertices are children of j # e. Which verte" is parent of h #

o # g. Which vertices are ancestors of m #


f. Which vertices are siblings of h. Which vertices are descendants of b #

$. build a binar% search tree for the words oenology , phrenology, campanology, ornithology, ichthyology, limnology, alchemy, and astrology using the alphabet order.

&. 'ow (an% co(parisons are needed to locate or to add each of words in the binar% search tree in e"ercise $ starting fresh each ti(e# a! )al(istr% ! paleontolog% %! et%(olog% d! glaciolog%

There are & omparisons for ea h the items.

*.

+his !uestion is deleted as the file is too huge to be uploaded into e,learning. +his !uestion is not i(portant.

- .eter(ine the order in which a preorder traversal visits the vertices of the given ordered rooted tree.

A. a, b, d , e, i, j , m, n, o, c, f , g , h, k , l , p
a, b, e, k , l , m, f , g , n, r , s, c, d , h, o, i, j , p, q

'.

/. 0epresent the e"pression e"pressions in

(( x + 2! 3! " ( y (3 + x !!

using a binar% tree. Write these

a. )refi" notation#

b. )ostfi" notation#

c. 1nfi" notation#

You might also like