Consider the Dijkstra’s self-stabilizing solution to mutual exclusion on a ring
ID: 3691181 • Letter: C
Question
Consider the Dijkstra’s self-stabilizing solution to mutual exclusion on a ring of n nodes. Suppose an execution starts from a configuration with k different turn values, where 1 < k n.
(a) What is the maximum number of changes of the local turn variables at all nodes by the time all the values of the turn variables are equal?
(b) What is the minimum such a number of changes? Describe specific configurations that support the answers.
Clarification:
The ultimate answers, except for the configurations, are to be functions of the two parameters: the number of nodes n and the number of turn values k, unless you think one of these parameters is irrelevant. More precisely: give your answers in the form of either (f(n,k)) or (f(n)), in the case of maximum, and of either O(g(n,k)) or O(g(k)), in the case of minimum, for some functions f and g.
Explanation / Answer
public class Dijkstra { 2 3 // Dijkstra's algorithm to find shortest path from s to all other nodes 4 public static int [] dijkstra (WeightedGraph G, int s) { 5 final int [] dist = new int [G.size()]; // shortest known distance from "s" 6 final int [] pred = new int [G.size()]; // preceeding node in path 7 final boolean [] visited = new boolean [G.size()]; // all false initially 8 9 for (int i=0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.