Hi all.
I've came across this way of storing edges in many codes:
void addEdge(int u, int v) {
head[edges] = v;
prev[edges] = last[u];
last[u] = edges++;
}
How does it work? Why is it used over the 'traditional' array of vectors?
I appreciate your help!