Can we use static array

in this code can we use an static array of lists of size V (line no. 16). please explain your answer with reasons as I am a bit confused about it

We don’t know the value of V beforehand which is required to make a static array

but mam we are passing the value of V while initializing the graph
and we used to do the same before , we used to take input n as size of array and then the elements of array using a loop as there also value of n was not known…

Thats not a good practice, but yes you can do that

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.