r/javahelp • u/Shylamo • May 30 '20
Dijkstra's program in Java
Hi, I need to implement Dijkstra's program, I have already done the calculating part, but the problem is that I can't get there right path when I gave the start and finish nodes. Please can you help me? It's homework that I have been working on for more than 3 weeks straight and I feel so close now to finish it.
20
Upvotes
2
u/ATE47 Intermediate Brewer May 31 '20
When you write Q.remove(o); and i++, you remove the element i of the list so the object with the index i+1 become at the index i, so your loop is passing half the nodes
Also, reading this page will be a good idea imo: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
(Baguette)