What is the operational cost of the algorithm? How could it be improved? Explain for both cases.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Given Prim's pseudocode algorithm used as voraz algorithm (Figure 1)

Where (pi) are the ancestors of the vertex in question and Q are the vertices that can be considered for expansion. Find the minimum generation tree for the graph in Figure 2

To carry out the exercise, the data structure shown in the second Table will be used.

(First Table: PRIM data structure)

Vertex a b c d e f g h i
weight 0 inf. inf. inf. inf. inf. inf. inf. inf.
pi null null null null null null null null null
Q X X X X X X X X X

* inf. = infinity symbol

In an initial stage, the vertex a is selected and therefore we start with a weight of 0. Then, the neighbors are updated (for example, the neighbors of a are b and h). They will only be updated if the update is a lower weight than an already known one. For example, from vertex a it expands to vertex b and h leaving the table as shown below:

(Second Table: First iteration)

Vertex a b c d e f g h i
weight 0 4 inf. inf. inf. inf. inf. 8 inf.
pi null a null null null null null a null
Q X --- X X X X X X X

To find the most promising one, we must go through the list of weights to find the one with the lowest weight, which in this case is from vertex b. This is marked with "---" in Q because now b is part of the solution.

What is the operational cost of the algorithm? How could it be improved? Explain for both cases.

8
7
b
d
4
2
9.
a
а) 11
i
4
14
e
6
8
7
10
h
f
1
2.
Transcribed Image Text:8 7 b d 4 2 9. a а) 11 i 4 14 e 6 8 7 10 h f 1 2.
while Q + {} do
u+ extractMininum(Q)
X + XU{(u,7[u])} // if u # r
foreach v E Adj[u] do
if (v E Q) and (w(u, v) < weight|[v]) then
weight (u] +- w(и, v)п[u] +- и
end if
end for
end while
return X
Transcribed Image Text:while Q + {} do u+ extractMininum(Q) X + XU{(u,7[u])} // if u # r foreach v E Adj[u] do if (v E Q) and (w(u, v) < weight|[v]) then weight (u] +- w(и, v)п[u] +- и end if end for end while return X
Expert Solution
steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY