Hints for Question 2
In the first round only one of the processors located at one of the ends of
the network sends a message. What is the data in that message?
In the first part of the algorithm processor ID's are compared as messages
travel along the network. So at the end of the first part of the algorithm
the largest ID will be known by whom?
After the largest ID is determined, during the second part of the algorithm
the largest ID is sent back along the network so each processor will know who
the leader is and all processor can change
their status to the proper value.
Try to solve the problem with the above hint. If you really do not see
how to design the algorithm, here is are additional