Learning Sites: To learn Click Here Some Problems About Linked List Dynamic Memory Allocation: Code Snippet:
1 2 3 4 5 6 7 8 |
int dim; cin>>dim; string **s = new string *[dim]; s[0] = new string[100]; s[1] = new string[100]; s[0][1]="ajksdhjkasdh"; s[1][0]="sswd"; cout<<s[1][0]<<" "<<s[0][1]<<"\n"; |
BellmanFord Algorithm: Take all the edge in a struct as:
1 |
Struct Edge{int source,destination,cost}; |
Relax all the edge for (node-1)(e.g. total number of node of the vertex) number of time. After that check one more time if all the edges are