其他分享
首页 > 其他分享> > Week1.Interview

Week1.Interview

作者:互联网

Social network connectivity.

Given a social network containing nn members and a log file containing mm timestamps at which times pairs of members formed friendships, design an algorithm to determine the earliest time at which all members are connected (i.e., every member is a friend of a friend of a friend ... of a friend). Assume that the log file is sorted by timestamp and that friendship is an equivalence relation. The running time of your algorithm should be m \log nmlogn or better and use extra space proportional to nn.

 

标签:containing,members,Interview,file,Week1,network,friend,log
来源: https://www.cnblogs.com/JasonJ/p/14402928.html