Arrays
Ordered indexable collection for O(1) access by position.
Nodes and edges modeling networks, dependencies, and paths.
Spot the middle node of a star-shaped graph by comparing only the first two edges, with no counting and no traversal.
Give every person one score built from who trusts whom, then read off the only person who trusts nobody and is trusted by all.
Use a stack to open rooms with the keys you collect, and decide whether every room can be reached from room 0.
Treat a grid of ones and zeros as a graph and flood fill each island, sinking cells as you count, to find the largest one.
Make a deep copy of a graph that contains cycles by keeping a map from each original node to the single copy that stands for it.
Paint the graph in two colours with a breadth-first walk and decide whether the nodes split into two groups with no edge inside a group.
List every route from the first node to the last in a directed graph with no cycles, using backtracking to undo one move at a time.
Find the smallest set of starting nodes that reaches everything by collecting exactly the nodes with no arrow pointing at them.
Find every bridge in a network using discovery times and low-link values from a single depth-first walk.
Order a pile of airline tickets into one trip from JFK that uses every ticket once, picking the alphabetically smallest valid route.
Ordered indexable collection for O(1) access by position.
Nodes linked by pointers — insert and delete without shifting a contiguous block.
Last-in, first-out collection for undo, parsing, and nested work.
First-in, first-out collection for scheduling, BFS, and buffering.
Key-to-value lookup in average O(1) via hashing into buckets.
Hierarchical nodes with parent–child links for ordered and nested data.