What is the time taken(number of steps) in this problem by applying DFS?

Правка en1, от sankalp_, 2018-05-11 02:27:04

I came across this problem and I submitted a DFS solution and it got AC.

But it took way lesser time than I expected it to take.

Like...

Forgetting all the vertices which can't be reached, at every level we have 10 new vertices and the depth is 1000 in the worst case.

Wouldn't a DFS have a huge number of steps and this code took around 30ms.

Any reasoning as to why my reasoning is wrong would be highly appreciated :)

Теги #graphs, #dfs, #time

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский sankalp_ 2018-05-11 02:27:04 618 Initial revision (published)