如何区分两个很长的字符串在C + +? [英] how to differentiate two very long strings in c++?

查看:122
本文介绍了如何区分两个很长的字符串在C + +?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解决 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.

这篇关于如何区分两个很长的字符串在C + +?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆