Graphs 03- Adjacency List Implementation for Integer Data

cant we make an array of type node* to store the head of each linked list?

Hello @Shreya-Gupta-2383169445069382,

You can do that also.
But, doing this increase the computation for you.

Reason:
Storing the values makes it easy to search
Now, if you would store the node
Then, you have to add another instruction to find the data stored in it, during search operation.

There can be different approaches to single problem.

Hope, this would help.
Let me know if you still have any doubt.
Give a like if you are satisfied.

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.