Does anyone here uses Vscode? I am trying to get this extension called 'live server' to work but it doesn't work as expected ( it doesn't auto reload the page and i have to manually do it myself). If this isn't the right place to ask it, can you suggest me the appropriate room to do so? Thanks!
but now i want to be able to not just print out the vertices as i visit them , but instead i want to store them in a separate vector as i visit them and then finally return the whole vector from the bfs function at last
I understand that 'i' is an iterator for the vector of the nodes ( representing adjacency list ). But how is that then being used as an index to a different vector 'v'?
my question is, why do I need to use v[*i] , that is why do I need to use a pointer of i ? And why would it not work if i do not use it and instead just use v[i]
here, v is the bool vector used to maintain the info about whether a vertex has been visited or not and g is a vector of vectors used to represent the adjacency list.
I'm getting arrayindexoutofbounds exception at lines 7 and 18 , can someone please let me know why and how I can possibly get the desired output (i.e. the sorted array)