Sir, where am I doing mistake ? please help me to remove that
hello @chandreshmaurya
u havent complete the bfs code.
u have marked only immediate negibours distance as 6 ,what about other nodes?
check this->
Sir, Iβm getting problem in dry run. when i do dry run, i get β6, 6, 12β in 1st input and β12, 6β in 2nd input. which is incorrect
sir, please help me to understand this code with dry run.
Itβs simple bfs.
If u are having any issue in understanding this. Then simply apply ur standard bfs and then multiply each of its distance by 6
Sir, Actually Iβm not getting the the question. in question, it is said that when " if βsβ is disconnected from a node, print -1 as the distance to that node. "β¦ but, jo input me graph diya hai usme to koi bhi node disconnected nhi hai, phir bhi output me β-1β result aa rha hai
Sir, mujhe given input se output ko smjha dijiye. please
4 2
1 2
1 3
1
ise dekho , yaha pe 4 veritces has (1,2,3,4) aur 2 edges hai (1-2, 1-3)
aur source 1 hai , to 1 se hum 2 pe 6 cost me pahuch sakte hai
similary 1 se 3 pe 6 cost me pahuch skate hai
1 se 4 pe nahi jaa skate isiliye uske liye -1
isiliye output
6 6 -1 diya hua hai
thank you sir, Now itβs clear. mai question ko hi galat smjh rha tha
Sir, i did as u told. But, iβm getting segmentation fault. please help me to remove my error from yhe code. My code-> https://ide.codingblocks.com/s/483509
make ur distance array of size v+1
sir, iβm still getting segmentattion fault. please check my code. code-> https://ide.codingblocks.com/s/483642
check now
done sir, thank you β¦