i am not able to find my mistake pls help me
Why my output is not correct?
actually this statement will not initialize the array with -1
int *parent=new int[v]{-1};
you check this by printing the array
this will only initialize the first element of array to -1 rest are 0;
you have to run a loop and initialize every element =-1;
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.