Path Existence Queries in a Graph I
Sorted values only connect to their neighbours, so the connected pieces are runs of consecutive values with small gaps; label each run and compare labels.
Sorted values only connect to their neighbours, so the connected pieces are runs of consecutive values with small gaps; label each run and compare labels.