Questions tagged «communication-complexity»

6
在一个间隔中找到两个数字的最大异或:我们能做得比二次更好吗?
lllrrrmax(i⊕j)max(i⊕j)\max{(i\oplus j)}l≤i,j≤rl≤i,j≤rl\le i,\,j\le r 天真的算法只检查所有可能的对。例如在红宝石中,我们有: def max_xor(l, r) max = 0 (l..r).each do |i| (i..r).each do |j| if (i ^ j > max) max = i ^ j end end end max end 我感觉到,我们可以做得比二次。是否有针对此问题的更好算法?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.