c++ EDIT ALGORITHM

happyoht11의 이미지

long dist[10000][10000]; 이 줄에서 배열의 크기를 1억개로 변경하고 싶은데 배열 크기가 너무 크다고 에러가 나네요. 에러가 안나게 하려면 어떻게 고쳐야 할까요?

#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <stdio.h>//C language header file
using namespace std;
 
string input1, input2;
long dist[10000][10000];
 
long levenshtein(string& input1, string& input2){
    for(long i=1; i<=input1.length();i++)
        dist[i][0] = i;
    for(long j=1; j<=input2.length();j++)
        dist[0][j] = j;
 
    for(long j=1; j<=input2.length();j++){
        for(long i=1; i<=input1.length();i++){
            if(input1[i-1]==input2[j-1])dist[i][j]=dist[i-1][j-1];
            else dist[i][j] = min(dist[i-1][j-1]+1,min(dist[i][j-1]+1,dist[i-1][j]+1));
        }
    }
    for(long j=0;j<=input2.length();j++){
        for(long i=0;i<=input1.length();i++)
            printf("%d\t",dist[i][j]);
            printf("\n");
    }
    return dist[input1.length()][input2.length()];
}
int main()
{
    cin>>input1>>input2;
    cout<<"Edit Distance"<<levenshtein(input1,input2)<<endl;
}

chocokeki의 이미지

멤올희 할당을 받을 수 있는 여러 방법 중 하나로 뭐가 있을까요~~

익명 사용자의 이미지

멤올희는 누구에요?

익명 사용자의 이미지

그런데 아무도 답을 달아 준 것 같지 않은데 이 글의 제목은 왜 이리 자주 바뀔까요?