Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Translate this to java from JavaScript please Function shortestPathDijkstra(GRAPHS) {//var G = GRAPHS.mazeB(); var G = GRAPHS.graph_fig_9_20();//G.print(); return; var sNode;//source node number while (sNode=G.nnum ||

Translate this to java from JavaScript please
image text in transcribed
Function shortestPathDijkstra(GRAPHS) {//var G = GRAPHS.mazeB(); var G = GRAPHS.graph_fig_9_20();//G.print(); return; var sNode;//source node number while (sNode=G.nnum || sNode81!==0) {sNode = Number(prompt("source node? (int 0 to "+(G.nnum-1)+*)?"));} var edge, n, ob;//temps var pq = makePriorityQueue();//priority queue for best performance var pLen; for (var i=0; i 0) {//process the min node on the heap ob = pq.getMin(); pq.delMin(); n = ob.val; if (G.nodes(n).handled) {continue;}//might be in pq from earlier pathlength G.nodes(n).handled = true; edge = G.nodes(n).adj;//deal with out edge nodes if any while (edge!==null) {if (!G.nodes(edge.tn).handled) {//dont process if we have already done it pLen = G.nodes(n).dist + edge.weight; if (pLen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

Question What is a secular trust?

Answered: 1 week ago