I was studying Dijkstra algorithm code given at this link -> https://java2blog.com/dijkstra-java/
Can someone explain the following 2 parts of the code?
1) Why a
1) PriorityQueue only evaluates priority when entries are inserted. Just changing the priority on v
will not cause this evaluation, so it will have no effect.
2) The basic contract for compareTo
is that it returns 0 iff both instances or considered equal. 1 if this is considered "bigger" -1 if this is considered "smaller". Double.compare(..)
creates this semantic for a Double
value.