MockQuestions

Amazon Software Engineer Mock Interview

Question 3 of 26 for our Amazon Software Engineer Mock Interview

Get More Information About Our Amazon Interview Questions

Question 3 of 26

How would you implement Dijkstra's Shortest Path using a programming language with which you are familiar?

"When programming in Ruby, I would implement Dijkstra's Shortest Path by creating an algorithm to identify the shortest path between two nodes which have positive-edge weights within the graph. I would first query my libraries to see if I have done this before or if another developer had already created a similar algorithm. If not, I would follow the guidelines within Ruby to accomplish this."

Next Question

How to Answer: How would you implement Dijkstra's Shortest Path using a programming language with which you are familiar?

Advice and answer examples written specifically for an Amazon job interview.

  • 3. How would you implement Dijkstra's Shortest Path using a programming language with which you are familiar?

      How to Answer

      When asked about how you would implement a procedure or perform an operation, the interviewer hopes to learn more about how you go about doing the job for which you are interviewing. This is known as an operational question. When answering an operational question, you should step the interviewer through the process briefly and directly. It may help break the process down into smaller steps to help the interviewer better understand your methodology. You should be prepared for follow-up questions any time you answer an operational question.

      Answer Example

      "When programming in Ruby, I would implement Dijkstra's Shortest Path by creating an algorithm to identify the shortest path between two nodes which have positive-edge weights within the graph. I would first query my libraries to see if I have done this before or if another developer had already created a similar algorithm. If not, I would follow the guidelines within Ruby to accomplish this."