Skip to content
StackDecode
GraphsExplained

Bidirectional BFS

Search from both ends at once and stop when they meet.

Time

O(b^(d/2))

Extra space

O(b^(d/2))

Use it for

Shortest path with a known target.

An animated walkthrough for this algorithm isn’t built yet. The summary above explains the idea; see the related animated algorithms below to practise the same technique.