Can you tell my mistake

here instead of vertices starting from 0 I want them to start from 1. So I made the the necessary changes in the loop and indexing. But my answer is still not coming.

Now it’s working https://ide.codingblocks.com/s/575602. Since you are using 1 based indexing, you have to line 14 and 15 to V+1

sir, but why? I want indexes from 1 to 4. Earlier I wanted from 0 to 3. So why to increase memory, in both cases we require memory for 4 lists

You are trying to access l[v], which will give segmentation fault. So you need to declare it as l[v+1], so that l[v] is valid memory location.

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.