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)
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)
本文介绍了一种在环形网络中选举领导者的算法。该算法通过各进程传递标识符来确定领导者,当一个进程收到比自己大的标识符时会继续传递;收到更小的标识符时则丢弃;若收到的标识符与自身相同,则宣告自己为领导者。此算法的时间复杂度为O(n),通信复杂度为O(n²)。
1077

被折叠的 条评论
为什么被折叠?



