In the 9th line why have we taken v+1 memory , we are starting from 1 and not 0. So if we want memory for 4 vertices we require only 4 integer memory and not 5
You need only array of size V where V is the number of vertices, it doesnt cause any problem if we take some extra memory but it will cause out of bound error in case the array is not big enough so if you are not sure then its better to for the vector to be a little bigger
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