Project 3 - Leader election on a ring Write a class KingOfTheRing (and other classes as needed) that implements the O(n

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Project 3 - Leader election on a ring Write a class KingOfTheRing (and other classes as needed) that implements the O(n

Post by answerhappygod »

Project 3 - Leader election on a ring
Write a class KingOfTheRing (and other classes as
needed) that implements the O(n log n) message complexity leader
election algorithm described in class for a bidirectional ring of
processors. The processor with maximum identity should be elected
as the leader. All the processors initiate the algorithm
simultaneously.
You are encouraged to examine the classes
ErrorFreeBoomRevised and CommunicationNetwork published in
github.
Input
The input to KingOfTheRing consists of a sequence of
integers.
The first integer is the number n of processors in the
ring.
The next n integers are the identities of the
processors.
Output
At the end of the algorithm every processor outputs the
following
The leader prints
<id>: I AM THE LEADER
and then it invokes CommunicationLink.printStatistics()
that will add its output.
Every other processor prints
<id>: The leader is <leader_id>
Where <id> stands for the id of the processor and
<leader_id> stands for the id of the leader.
YOU SHOULD NOT PRINT ANYTHING ELSE TO THE
OUTPUT.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply