LCR Algorithm-Leader Election

The idea of this algorithm is that each process starts by passing its own identifier to its neighbor. Whenever a process receives an identifier from its neighbor, it either:

   1. passes it on around the ring, if the id received is greater than its own,
   2. discards it, if the id received is less than its own, or
   3. declares itself the leader, if the id received matches its own.

时间复杂度是n
通信复杂度是o(n2)

你可能感兴趣的:(idea)