分而治之(通过最少的通话秘密分享)
Divide n Conquer (Secret Sharing through minimum calls)
There are n number of students in a class. Teacher tells one secret to
each student. The only way to share the secret is through a phone
call. Using divide and conquer, design an algorithm to find the minimum
number of phone calls required so that each student get all the
secrets.
我的一个朋友问我这个。我花了一些时间来画一个草图,即我将有一系列学生,我会递归地打破它,直到我有一个学生,然后在加入他们后我会计算这两个之间已经进行了调用。
在组合两对时,我会计算两次调用等等。这是令我困扰的一点,或者可能在这里我遗漏了一些东西。
X1 X2 (1 call)
X3 X4 (1 call)
X1 -----> X3
X2 -----> X4 (2 more calls)
感谢任何帮助。
n>=4人共享所有n条信息的最佳方案是2n-4,如图paper。
这个问题的分而治之的方法说明如下:
For four persons
A, B, C and D, say, take conversations AB, and CD, followed by
AC and BD. For every additional person P, schedule one conversation
AP, before A, B, C and D interchange their knowledge,
and another conversation AP afterwards.
There are n number of students in a class. Teacher tells one secret to each student. The only way to share the secret is through a phone call. Using divide and conquer, design an algorithm to find the minimum number of phone calls required so that each student get all the secrets.
我的一个朋友问我这个。我花了一些时间来画一个草图,即我将有一系列学生,我会递归地打破它,直到我有一个学生,然后在加入他们后我会计算这两个之间已经进行了调用。
在组合两对时,我会计算两次调用等等。这是令我困扰的一点,或者可能在这里我遗漏了一些东西。
X1 X2 (1 call)
X3 X4 (1 call)
X1 -----> X3
X2 -----> X4 (2 more calls)
感谢任何帮助。
n>=4人共享所有n条信息的最佳方案是2n-4,如图paper。
这个问题的分而治之的方法说明如下:
For four persons A, B, C and D, say, take conversations AB, and CD, followed by AC and BD. For every additional person P, schedule one conversation AP, before A, B, C and D interchange their knowledge, and another conversation AP afterwards.