= 2

=16truecm =1.9truecm =24.5truecm =1.7truecm

.65em

#include <LEDA/graph.h>


void DIJKSTRA(& graph G, node s, edge_array(int) cost, node_array(int) dist)

{ & & node_pq(int) PQ(G);

&node u, v; &edge e; &int c;


&forall_nodes(v, G) & &{ & dist[v] = infinity; & & & PQ.insert( v, dist[v]); & & }


& dist[s] = 0; &PQ.decrease_inf(s, 0);


&while ( ! PQ.empty()) & &{ &u = PQ.delete_min()


& & &forall_adj_edges(e, u) & & & &{ & v = G.target(e); & & & & & c = dist[u] + cost[e]; & & & & &if ( c < dist[v]) & & & & & &{ & dist[v] = c; & & & & & & &PQ.decrease_inf(v, c); & & & & & & } & & & & }


& & }


}

15truecm

#include <LEDA/d_array.h>


main() { & &d_array(string,int) Anzahl (0);


&string w;


&while &(cin > > w) Anzahl[w] + +;


&forall_defined(w, Anzahl) printf("%s %d \n", w, Anzahl[w]);

}