Professional Documents
Culture Documents
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.
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 #
$. 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%
*.
+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
'.
(( x + 2! 3! " ( y (3 + x !!
a. )refi" notation#
b. )ostfi" notation#
c. 1nfi" notation#