Graphs Directed and undirected graph

I have simple doubt in a line 7.
why are we using *l, why pointer ?

Hey @souravrao3110
We are using pointer there because we have created Graph class and for each Graph(different class graph objects) different size of list will be required which we can create dynamically in the constructor

You can also implement without using pointers ,it actually depends on you that how you want to implement it .

okay, i got it.
Thank you sir.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

int **dp = new int[s1.length() +1][s2.length() +1];
why cant we assign 2d array like this ?
How to assign this?

Hey @souravrao3110
We cant do so because there are defined rules for each programming language and we have to stick to them.
to define 2d array
int**dp=new int*[s1.length()+1];
for(int i=0;i<s1.length()+1;i++)dp[i]=new int[s2.length()+1];
And from next time please open separate doubts for different kind of questions .:slight_smile: