In the array of list lecture we declare the size of array of list by Graph g(4).And in BFS traversal we have not declared size .And we also use graphg why it so?
please clear these 3 doubts.
Array of list doubt + bfs
hi @divesh2000 please share the relevant codes using CB IDE or ask your doubts under the respective lectures.
@divesh2000 in the first code we are using an array of list, so we need to tell the size of the array beforehand. In the BFS code we are using a map of list, maps are resizeable, we dont need to tell its size beforehand we can keep on inserting elements into it.
Graph is a class, so by Graph<int> g we are declaring an object of the class Graph.
we declare the object by Graph<int> g .Why cannot by Graph g ?
@divesh2000 this is a templated class, if you dont use template then you can directly write Graph g.
Thank you so much for clearing doubts.
From where , I can give you rating?
Hi @divesh2000 when you mark the doubt as resolved on your end, there’ll be small popup for the feedback!
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.