avatar
An algorithm question.# Programming - 葵花宝典
k*r
1
Suppose there is 100 game players. What is the number of games that will be
played to find out the final winner? Require time complexity should be
CONSTANT.
avatar
b*n
2
你说你这题的主要精神是什么吧,2人对决,100人比2场,1万人比5场。有这好算法你能
得诺贝尔数学奖了。



【在 k******r 的大作中提到】
: Suppose there is 100 game players. What is the number of games that will be
: played to find out the final winner? Require time complexity should be
: CONSTANT.

avatar
N*n
3
Is it possible?

【在 k******r 的大作中提到】
: Suppose there is 100 game players. What is the number of games that will be
: played to find out the final winner? Require time complexity should be
: CONSTANT.

avatar
t*l
4
那简单啊,把把每场比赛时间用(n-1)normalize 一下不就行了。





【在 k******r 的大作中提到】
: Suppose there is 100 game players. What is the number of games that will be
: played to find out the final winner? Require time complexity should be
: CONSTANT.

avatar
g*c
5
只有一个比赛场地吗?问题没法给具体的答案,只能给个idea。
一对一淘汰的话,就建个blance binary tree,log(2)100=7 log(2)10000=14
也就是你要的数量级,不知道这道题是出至何处,哪门课?要你想多深。

【在 k******r 的大作中提到】
: Suppose there is 100 game players. What is the number of games that will be
: played to find out the final winner? Require time complexity should be
: CONSTANT.

avatar
p*u
6
I finally think OP was asking for a parallel algorithm.
avatar
c*t
7
Constant time to find the result? It would just be an formula to calculate
the # of comparisons to find the result. It's just like you can use
Fib math formula to directly calculate the N-th number in constant time, or
use linear algorithm to find the result.
Algorithm wise, the problem can be solved in linear time using N-1
comparisons. If using parallelism, if I remember correctly, ln(N) time is
required, but overhead is large. You can think it as merge sort to
distribute the comparison ta
avatar
c*r
8
if it's constant time, is it doable?

【在 c*****t 的大作中提到】
: Constant time to find the result? It would just be an formula to calculate
: the # of comparisons to find the result. It's just like you can use
: Fib math formula to directly calculate the N-th number in constant time, or
: use linear algorithm to find the result.
: Algorithm wise, the problem can be solved in linear time using N-1
: comparisons. If using parallelism, if I remember correctly, ln(N) time is
: required, but overhead is large. You can think it as merge sort to
: distribute the comparison ta

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。