Use of list container

Why are we using list for this problem?What is the reason for using list container?

@Senjuti256 you can use other ways too but using list is simple thats why.
map can also be used

list is basically Doubly linked list which contains 2 addresses. Here we are not storing addresses then why and how to think that list should be used?

@Senjuti256 basically humme aisa koi ds chahiye tha jo sab vertices ke neighbour store kare so used array of list . tum aur bhi use kar sakte ho like map ya koi aur jo kar paaye but common way sir ne bata diya

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.