code is working fine if dp size is [1000][1000]
but the acc to question we need dp of size [100000][100000]
what to do now
Dp size causing problem
hello @pankajsingh
yeah as per question it should be of size 100000 X 100000
but we cannot create dp array of that big size because it will take too much memory.
so what we are doing is we r creating small size dp array to store only few values (not remembering/memoising every value ) and making recusive call for other values.
sir plese give me code to learn this properly
got your point one more question why taking large array in recurssion showing segmentation fault if i use the same dp array of size [5000][5000] in recurssion insted of globally declaring it will show me segmentation fault why plase tell me
see function scope has lesser memory capacity than global scope , thats why sometime declaring array inside function shows segmentation fault but works fine when declared as global array
“function scope has lesser memory capacity than global scope” are you talking about int main () function ?because iam declaring inside the int main function
yeah main is also a function.
sir we are not taught about this so please tell me a good source to learn this thing
check this