edited by
217 views
6 votes
6 votes
Let $G$ be a directed graph whose vertex set is the set of numbers from $0$ to $100$. There is an edge from a vertex $i$ to a vertex $j$ if either $j = i + 2$ or $j = 7i$. The minimum number of edges in a path in $G$ from vertex $0$ to vertex $100$ is __________
edited by

3 Answers

Best answer
3 votes
3 votes
$0-2-14-98-100$

So, total $4$ edges.
selected by
0 votes
0 votes

this is similar to dynamic programming problem as every node has 2 choice either jump to 7i th node or i+2th node, we have to optimize number of edges but let us solve greedily  always better to back track from 100 as 98 closest 100 having edge and  divisible by 7 so before edge mus be 14 and 2 and 0 so total 4 edges

Answer:

Related questions

5 votes
5 votes
1 answer
3
gatecse asked Sep 7, 2020
284 views
Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph where all edge weights are equal?Dijkstra's...
4 votes
4 votes
1 answer
4