DCP-466: Sanvi and TreeMap.....bfs problem

Dev Skill archived problems can be discussed here.

DCP-466: Sanvi and TreeMap.....bfs problem

by shawonchy123 » Sun Feb 04, 2018 2:32 am

In the editorial it says this problem could be solved by bfs.but this is a weighted graph.how do i implement bfs to find the distance between two nodes in a weighted graph.i knew that bfs can not be implement in a weighted graph.
 
Posts: 2
Joined: Wed Jan 17, 2018 3:20 pm

Re: DCP-466: Sanvi and TreeMap.....bfs problem

by feodorv » Thu Feb 15, 2018 4:01 am

"but this is a weighted graph"

There is a weighted tree! So it is possible.

But i see no need in such algorithms. Single beforehand calculated matrix dist[5][5] can be useful.
 
Posts: 11
Joined: Thu Jun 15, 2017 3:37 pm


Who is online
Users browsing this forum: Bing [Bot] and 1 guest
cron