You are not logged in. Please login at www.codechef.com to post your questions!

×

Shortest path from BFS and DFS

Hi all, I recently learnt how to implement breadth-first-search (BFS) using C++ STL vector. However, though I know the algorithm of depth-first-search (DFS) but cannot understand how to implement it using C++ STL. Please provide me a code using C++ STL to implement it. Also kindly tell me how the shortest path algorithms (such as Dijkstra's algorithm or Floyd-Warshall's algorithm) can be derived from BFS and DFS.

Thanks in advance!

asked 21 Jan '15, 23:08

anupam_datta's gravatar image

4★anupam_datta
379526
accept rate: 7%

plz make ur query a bit more clear

(23 Jan '15, 15:42) arpanb83★

link

answered 22 Jan '15, 14:14

ketanhwr's gravatar image

6★ketanhwr
1.9k31844
accept rate: 15%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×672
×463
×116

question asked: 21 Jan '15, 23:08

question was seen: 6,459 times

last updated: 23 Jan '15, 15:42