Solve A-level Computer Science graph and search problems
8 steps · about 1 h 22 min · Intermediate
- Model a problem as a graph (article, Wikipedia, 10 min)
Vertices, edges, direction and weights turn a scenario into a precise structure.
- Choose an adjacency list (article, Wikipedia, 9 min)
Lists store sparse connectivity efficiently and support neighbour traversal.
- Compare an adjacency matrix (article, Wikipedia, 9 min)
Matrices trade more space for constant-time edge lookup.
- Trace breadth-first search (article, Wikipedia, 11 min)
A queue explores unweighted distance layers and supports shortest path discovery.
- Trace depth-first search (article, Wikipedia, 11 min)
A stack or recursion follows one branch before backtracking.
- Find weighted shortest paths (article, Wikipedia, 12 min)
Repeatedly settling the smallest tentative distance works when weights are nonnegative.
- Justify traversal state (article, Wikipedia, 10 min)
Visited markers and predecessor records prevent loops and reconstruct results.
- Compare algorithmic cost (article, Wikipedia, 10 min)
The representation and number of vertices and edges determine practical complexity.