2(n-1) induction

942 Views Asked by At

There are $n$ cities and every pair of cities is connected by exactly one direct one-way road. Now more one-way roads have been added between some cities so that between some pairs of cities there may be two direct roads between them, for example, there may now be a road going directly from some city A to some city B and a road going directly from city B to city A. Note that now between every pair of cities there is at least one direct road.

The goal is to find a dead-end city, if it exists, i.e., a city D to which there is a direct one-way road from every other city, but there is no direct road going from D to any other city. You are allowed to make only one type of query – “Is there a direct road going from city A to city B?” The answer to this query will be a “Yes” or a “No”. Use mathematical induction to show that if there are $n$ cities then one can find a dead-end city, if there is one, using at most $2(n − 1)$ queries.

So far I've gotten:

We will prove this claim using induction on n.

IH: Assume that the claim is true when $n = k$, for some $k > 1.

$2(k-1)$

BC: $k = 2$

$2(2-1) = 2$

IS: We want to prove that the claim is true when $n = k + 1$

Am I on the right path or?

1

There are 1 best solutions below

2
On

Yes, you're on the right track.

Hint: Your first question will rule out one city as a potential dead end. What would happen if you never asked about that city again, and simply pretended it didn't exist?