宋倩倩 发表于 2013-7-30 14:04:38

[google面试题]Describe 
an
 algorithm
 to 
identify 
each
 person\'s
 three
 friends.

There are no prior distinguishing characteristics of any of the m and the same program to identify the leader startsrunning on all of the mat 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 14:23:19

Good Answer: Have each server wait a random amount of time and then say "I'm it." The "I'm it" announcement is time‐stamped,and the computer that time‐stamped its announcement first is elected the leader.This approach requires sending out 9messages.If there is a tie,the computer scan repeat the procedure.Note that other answers are possible,but every correct answer will user and omness in someway
页: [1]
查看完整版本: [google面试题]Describe 
an
 algorithm
 to 
identify 
each
 person\'s
 three
 friends.