algorithms 讲解

If you do not have any programming experience and are not able to write java code, we will allow you
to submit your algorithms in detailed pseudocode similar to the one used in the lectures. However,
this should be the exception, not the rule; you are strongly encouraged to write your algorithms in
java and test them using the simulator. A test 且le will be provided for each algorithm. Additional
tests will be conducted on your code to assess its correctness.

  1. (Optional 10 marks) Consider a ring network of n > 1 processors in which n - 1 processors
    have the same identifier and one processor has a different identifier; the identifier of this last
    processor is larger than the identifiers of all other processors. An example of such a network is
    shown in the followig figure. In class we discussed an algorithm for the leader election problem
    on a synchronous ring with communication complexity 0(ηlog n). Assume that this algorithm is
    modi且ed so that whenever a processor with identifier id receives a message of the form (id', d', R),
    where id 二 id' and the value of variable d = 1 then the processor changes its status to NotLeader
    and then it discards the received message. For completeness, the modified algorithm is given in
    the last page of this assignment; the modification is highlighted in red.
    Compute the time complexity and communication complexity of the algorithm when executed
    on this kind of network. You need to explain how you computed the complexities and you need
    to indicate the order of the complexities.

你可能感兴趣的:(程序员)