My blog
My LinkedIn Profile

BOOKS i'm reading

Napoleon Hill Keys to Success: The 17 Principles of Personal Achievement, Napoleon Hill, ISBN: 978-0452272811
The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich (Expanded and Updated), Timothy Ferriss, ISBN: 978-0307465351
The Fountainhead, Ayn Rand, ISBN: 0452273331
Web Hosting Canada


Graph breadth-first traversal algorithm C++ implementation


Permalink 08:53:31 pm, by lano1106, 97 words, 7386 views   English (CA)
Categories: General, C++

Graph breadth-first traversal algorithm C++ implementation

I have posted on my website a small C++ program that I have been asked to write during an interview with Facebook at Fall 2009. One of their interview was related to graph theory and the problem was to find the the shortest distance between to nodes in a graph. The best algorithm to use to solve this problem is the breadth-first traversal algorithm.

You can look at the source code here at:

and you can read more about the breadth-first traversal algorithm in Robert Sedgewick excellent book on algorithms.

Comments, Pingbacks:

Comment from: Stephen Reis [Visitor] · http://www.terminalserverprinting.org/
Never had any interview where I was asked to write a program. Did that take you long to create Olivier; if ever it did facebook paid your time? Just asking out of curiosity.
PermalinkPermalink 10/11/10 @ 15:01
Comment from: lano1106 [Member]

You have about 30 minutes, maybe less than that to produce the program. That being said, I am not even sure that I had a working program during the alloted time. and no, they do not pay you for your time like any interviews in any company that I know and IMO, this is the right thing to do.

I have considerably embellished the program once I decided that I would publish it on my website. With all the comments, and all the cool STL usages within the program, I would say that I spent a good evening to bring the program as it is now.
PermalinkPermalink 10/11/10 @ 19:18
Comment from: stephen [Visitor]
Cool, I thought the interview was an all day affair hence my question about payment.
PermalinkPermalink 10/12/10 @ 06:10

Comments are closed for this post.

Olivier Langlois's blog

I want you to find in this blog informations about C++ programming that I had a hard time to find in the first place on the web.

April 2024
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        


Custom Search


XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 6

powered by