欧拉计划:请帮我理解#106
我已经解决了#103和#105,但我很难理解 #106 ,具体来说25这个数字是从哪里来的呢?
如果我们谈论的是具有相同数量元素的两个不相交子集,那么
1-elem vs. 1-elem: there are 4 x 3 = 12 comparisons
2 vs. 2: C(4, 2) = 6 comparisons
如果我们包括具有不同数量元素的不相交子集,那么
1 vs. 2: C(4, 1) x C(3, 2) = 12
1 vs. 3: C(4, 1) = 4
我在这里缺少什么?提前致谢。
I have solved #103 and #105, but I have a hard time understanding #106, specifically where does the number 25 come from?
If we are talking about two disjoint subsets with equal number of elements, then
1-elem vs. 1-elem: there are 4 x 3 = 12 comparisons
2 vs. 2: C(4, 2) = 6 comparisons
If we include disjoint subsets with non-equal number of elements, then
1 vs. 2: C(4, 1) x C(3, 2) = 12
1 vs. 3: C(4, 1) = 4
What am I missing here? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于前两种类型的比较,我得到了一半的数字——我认为与另一个比较相反的比较不算是新的比较。
例如,如果四个元素是 a、b、c、d,则 2 vs 2 比较 a、b 与 c、d 与 c、d 与 a、b 相同。所以我得到:
加起来确实是 25。
For the first two types of comparisons, I get half your numbers -- I think a comparison that is just the reverse of another comparison doesn't count as a new one.
For example, if the four elements are a,b,c,d, then the 2 vs 2 comparison a,b vs. c,d is the same as c,d vs. a,b. So I get:
which does indeed add up to 25.