Error:
LCS.cpp:18: error: no matching function for call to ‘dressArray(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >&, std::vector<std::vector<char, std::allocator<char> >, std::allocator<std::vector<char, std::allocator<char> > > >&, std::string&, std::string&)’
#include <iostream>
#include <vector>
using namespace std;
template<class T>
void dressArray(vector<T> &array, vector<T> &dirArray, string strY, string strX);
template<class T>
void printArray(vector<T> &array, string strY, string strX);
int main() {
string strY = "AKBMCND";
string strX = "AABACD";
vector < vector <int> > LCSArray(strY.size()+1, vector<int>(strX.size()+1));
vector < vector <char> > directionArray(strY.size()+1, vector<char>(strX.size()+1));
dressArray(LCSArray, directionArray, strY, strX);
printArray(LCSArray, strY, strX);
printArray(directionArray, strY, strX);
return 0;
}
template<class T>
void dressArray(vector<T> &array, vector<T> &dirArray, string strY, string strX) {
for(int i = 1; i < strY.size()+1; i++)
{
for(int j = 1; j < strX.size()+1; j++)
{
if((i == 0) || (j == 0))
{
array[i][j] = 0;
dirArray[i][j] = 'N';
}
if((i > 0) && (j > 0))
{
if(strY.at(i-1) != strX.at(j-1))
{
if(array[i][j-1] > array[i-1][j])
{
array[i][j] = array[i][j-1];
dirArray[i][j] = 'L';
}
else
{
array[i][j] = array[i-1][j];
dirArray[i][j] = 'U';
}
}
if(strY.at(i-1) == strX.at(j-1))
{
array[i][j] = (array[i-1][j-1])+1;
dirArray[i][j] = 'D';
}
}
}
}
}
template<class T>
void printArray(vector<T> &array, string strY, string strX) {
for(int i = 0; i < strY.size()+1; i++)
{
for(int j = 0; j < strX.size()+1; j++)
{
cout << "" << array[i][j] << " ";
}
cout << endl;
}
}


Sign In
Create Account


Back to top









