我想解决 Levenshtein_distance 这个问题,即字符串的长度是太庞大了。
I would like to solve Levenshtein_distance this problem where length of string is too huge .
EDIT2:
由于 Bobah 说,标题是错过领先,所以我不得不更新questoin的称号。
初始标题是
如何声明在C 100000x100000 2-D整型++?
含量为
有什么办法来声明INT X [100000] [100000]在C ++中。
当我宣布其全球范围内则编译器生成错误:数组的大小'X'太大
。
一种方法可以使用地图<对< INT,INT> ,INT> MYMAP
。
但分配和释放需要更多的时间有任何其他的方式就像uisng 矢量< INT>将myvec
;
Edit2 :
As Bobah said that title is miss leading , so i had updated the title of questoin .
Initial title was
how to declare 100000x100000 2-d integer in c++ ?
Content was
There is any way to declare int x[100000][100000] in c++.
When i declare it globally then compiler produces error: size of array ‘x’ is too large
.
One method could be using map< pair< int , int > , int > mymap
.
But allocating and deallocating takes more time . There is any other way like uisng vector<int> myvec
;
有关内存块大,最好的办法是使用操作系统提供的功能将虚拟内存的过程中动态分配。
For memory blocks that large, the best approach is dynamic allocation using the operating system's facilities for adding virtual memory to the process.
不过,看你想怎么大的块来分配:
However, look how large a block you are trying to allocate:
40 000 000 000 bytes
我把我的previous建议回。对于一个块大的,最好的方法是分析问题,并想出一个办法来使用较少的内存。
I take my previous advice back. For a block that large, the best approach is to analyze the problem and figure out a way to use less memory.