Changeset 30737 in osm for applications/editors/josm/plugins/utilsplugin2/src/edu/princeton
- Timestamp:
- 2014-10-18T23:07:52+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/DijkstraSP.java
r28298 r30737 46 46 47 47 // relax vertices in order of distance from s 48 pq = new IndexMinPQ< Double>(G.V());48 pq = new IndexMinPQ<>(G.V()); 49 49 pq.insert(s, distTo[s]); 50 50 int count = 0; … … 86 86 public Iterable<DirectedEdge> pathTo(int v) { 87 87 if (!hasPathTo(v)) return null; 88 Stack<DirectedEdge> path = new Stack< DirectedEdge>();88 Stack<DirectedEdge> path = new Stack<>(); 89 89 for (DirectedEdge e = edgeTo[v]; e != null; e = edgeTo[e.from()]) { 90 90 path.push(e); -
applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/EdgeWeightedDigraph.java
r30532 r30737 36 36 adj = (Bag<DirectedEdge>[]) new Bag[V]; 37 37 for (int v = 0; v < V; v++) 38 adj[v] = new Bag< DirectedEdge>();38 adj[v] = new Bag<>(); 39 39 } 40 40 … … 76 76 for (int v = 0; v < G.V(); v++) { 77 77 // reverse so that adjacency list is in same order as original 78 Stack<DirectedEdge> reverse = new Stack< DirectedEdge>();78 Stack<DirectedEdge> reverse = new Stack<>(); 79 79 for (DirectedEdge e : G.adj[v]) { 80 80 reverse.push(e); … … 124 124 */ 125 125 public Iterable<DirectedEdge> edges() { 126 Bag<DirectedEdge> list = new Bag< DirectedEdge>();126 Bag<DirectedEdge> list = new Bag<>(); 127 127 for (int v = 0; v < V; v++) { 128 128 for (DirectedEdge e : adj(v)) { -
applications/editors/josm/plugins/utilsplugin2/src/edu/princeton/cs/algs4/IndexMinPQ.java
r30532 r30737 174 174 // takes linear time since already in heap order so no keys move 175 175 public HeapIterator() { 176 copy = new IndexMinPQ< Key>(pq.length - 1);176 copy = new IndexMinPQ<>(pq.length - 1); 177 177 for (int i = 1; i <= N; i++) 178 178 copy.insert(pq[i], keys[pq[i]]);
Note:
See TracChangeset
for help on using the changeset viewer.