Hirschberg–Sinclair algorithm

The algorithm requires the use of unique IDs (UID) for each process.

The algorithm works in phases and sends its UID out in both directions.

While the messages are heading "out" each receiving process will compare the incoming UID to its own.

Phases continue until a process receives both of its out messages, from both of its neighbors.

At this time the process knows it is the largest UID in the ring and declares itself the leader.