邢城 发表于 2013-7-30 17:24:29

[google面试题]Describe
 a 
technique 
to
 identify
 a
 \"leader\"
 among
 a
 group
 of 
10 
identical
 servers
 that 
are
 all 
connected
 to
 every
 other 
server.

There are no prior distinguishing characteristics of any of them and the same program to identify the leader startsrunning on all of them at the same time.After ananswer is given,ask how much network traffic it requires and,if "ties" are possible,ask how you can break ties.

孙宏雷 发表于 2013-7-30 17:43:03

Good Answer:Have each server wait a random amount of time and then say "I'mit."The "I'mit" announcement is time‐stamped,and the computer that time‐stamped itsannouncement first i selected the leader.This approach requires sending out 9messages.If there is a tie,the computers can repeat the procedure.
页: [1]
查看完整版本: [google面试题]Describe
 a 
technique 
to
 identify
 a
 \"leader\"
 among
 a
 group
 of 
10 
identical
 servers
 that 
are
 all 
connected
 to
 every
 other 
server.