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

×

# problem implementing Dijkstra's single source shortest path algorithm

 0 I am trying to implement Dijkstra's single source shortest path algorithm using priority queue data structure and I got stuck at some point. I am using adjacency list representation of graph, I want to retrieve weight of edge(x,y) how to do it efficiently. asked 16 Jan '16, 15:30 1★arpit728 683●15●63 accept rate: 10%

 1 Answer is hidden as author is suspended. Click here to view. answered 16 Jan '16, 17:45 (suspended) accept rate: 36% I am coding in java, I am not familiar with STL so I am not getting this code. (16 Jan '16, 17:51) arpit7281★ 2 I tried explaining the code here with usage of STL specifically. Take a look . (16 Jan '16, 18:02) why priority queue is declared like this priority_queue ,vector >pq; why does it have vector in it. (16 Jan '16, 20:58) arpit7281★ 2 There are three parameters required here . 1. type of the elements (pair) 2. Type of the internal underlying container object where the elements are stored.(that's what vector is used here for ) 3. A binary predicate that takes two elements (of type T) as arguments and returns a bool.(this is optional, by default - max priority_queue ) Reference (16 Jan '16, 23:02)
 toggle preview community wiki:
Preview

### Follow this question

By Email:

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

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×1,197
×165
×125
×4
×2

question asked: 16 Jan '16, 15:30

question was seen: 1,959 times

last updated: 16 Jan '16, 23:02