Adjacent list implimentation

why we use *l in class we can also make a list and then in constructor we define it’s size

Hey @Pranav7g
You can make a list direct without dynamic allocation of fixed size say 10^5
But to optimize space we allocate it dynamically in constructor with the size of number of nodes.

If this resolves your query then please mark it as resolved :slight_smile:

If we don’t give the size means we only initialize the list like: listl and when we make constructor the we efine the size

u have to use resize or something to define size in constructor then