object_oriented_program's blog

By object_oriented_program, 9 years ago, In English

Hello I am solving this problem . I am confused on how to fill up the graph so that I can implement shortest path using bfs.

| Write comment?
»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

For every number from 1 to MAXM * 2 , you can push i * 2 and i — 1 in its adjacency list and after doing that , start a bfs from n and print distance[m]. Code -> 10110821

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

bfs