English 中文(简体)
如何在二次之内将最短的添加链用于任意的N<=600?
原标题:How can you compute a shortest addition chain for an arbitrary n <= 600 within one second?

http://www.homes.uni-bielefeld.de/achim/addition_chain.html” rel=“nofollow noretinger”>shortest addition chain (sac) for an arbitrary n <=600 within one second?

Notes

这是本月份在上进行的节目制作竞争。

添加链在数字上非常重要,因为它们是计算x^(连续复制)的最经济途径。

Knuth s 《计算机编程》第2卷,《半计数》对添加链和一些有趣的特性做了一番介绍,但我没有发现任何东西使我能够满足严格的业绩要求。

What I ve tried (spoiler alert)

首先,我建造了一个(高分层)特里<>/strong>。 (一) ;二、二、三、四、四、四、四、四、四) 但是,就价值和价值而言;400,经营时间与生产咖啡的时间相同。

然后,我利用该方案查找 一些有用的特性,以减少搜索空间。 因此,我能够在生产咖啡时建造最多600个解决方案。 但对于N而言,我需要把所有解决办法计算到N。 不幸的是, co合力测量出学前的学期。

由于问题在于,我最后填写了hard-coding a lookup table。 但是,由于共同点要求 施工。 我不知道他们是否铭记着眼,因此,我感到 d脏,就像一个che。 因此,这个问题。

Update

www.un.org/spanish/ecosoc 如果你认为是一条难以编码的全貌表是前进的道路,那么你能否提出理由,说明你为何认为完全计算/部分计算的解决办法/高温因素赢得了笔工作?

最佳回答

我刚刚获得关于这个问题的金证。 我不会提供完整的解决办法,因为问题仍然存在于现场。 我会给你一些方面:

  1. You might consider doing a deep-first search.
  2. There exists a minimal star-chain for each n < 12509
  3. You need to know how prune your search space.
  4. You need a good lower bound for the length of the chain you are looking for.
  5. Remember that you need just one solution, not all.

Good luck.

问题回答




相关问题
How to add/merge several Big O s into one

If I have an algorithm which is comprised of (let s say) three sub-algorithms, all with different O() characteristics, e.g.: algorithm A: O(n) algorithm B: O(log(n)) algorithm C: O(n log(n)) How do ...

Grokking Timsort

There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Enumerating All Minimal Directed Cycles Of A Directed Graph

I have a directed graph and my problem is to enumerate all the minimal (cycles that cannot be constructed as the union of other cycles) directed cycles of this graph. This is different from what the ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...