What is the time complexity for this code?
In this code I am trying to solve the "Palindrome Partitioning" problem. I am using recursion. I am trying to understand DP. and through this program I want to analyse it's time complexity. I want to compare it with the bottom-up approach of Dynamic Programming. The bottom-up approach takes O(n^3) and I have problem finding time complexity for recursive functions. Please help
string str;
int l;
int cut[200][200];
bool isPalin(int i,int j)
{
bool f=true;
for(int x=i,y=j;x<y;x++,y--)
if(str[x]!=str[y])f=false;
return f;
}
int func(int i,int j)
{
if(i==j){cut[i][j]=0;return 0;}
if(isPalin(i,j))return 0;
if(cut[i][j]!=-1)return cut[i][j];
cut[i][j]=9999999;
for(int k=i;k<j;k++)
{
cut[i][j]=min(cut[i][j],func(i,k)+1+func(k+1,j));
}
return cut[i][j];
}
int main()
{
while(1){
cin>>str;
l=str.size();
for(int i=0;i<l;i++)
for(int j=0;j<l;j++)
cut[i][j]=-1;
cout<<func(0,str.size()-1)<<endl;
}
return 0;
}