Baby-Step Giant Step Algorithm in c#. Hash table out of memory

淺唱寂寞╮ 提交于 2019-12-23 17:24:49

问题


I am trying to use a hash table to solve a discrete algorithm problem. I am using Shanks baby step giant step algorithm. My hash table contains about 11,000,000 keys and values. I keep getting an out of memory exception. is there any way to 'fix' this? or a different data structure to use? I am using Visual C# Express 2010 with .NET 4.0 Framework


回答1:


I feel this is cheating somewhat, but Wikipedia gives a solution

"The algorithm requires O(m) memory. It is possible to use less memory by choosing a smaller m in the first step of the algorithm. Doing so increases the running time, which then is O(n/m). Alternatively one can use Pollard's rho algorithm for logarithms, which has about the same running time as the baby-step giant-step algorithm, but only a small memory requirement."




回答2:


Try targeting a 64-bit platform. 32-bit executables often run out of virtual memory space these days.



来源:https://stackoverflow.com/questions/7472130/baby-step-giant-step-algorithm-in-c-hash-table-out-of-memory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!