Moving Graph Vs Tree Walk

Will the function that traversed the graph work equally well to traverse the tree?

+3
source share
2 answers

Well, a tree is a special type of graph called a directed acyclic graph, so yes ... The width of the first and the depth The first crawl works like a tree.

I could write a detailed explanation of the differences between the width and depth of the first detours, but I'm probably wrong (I'm not a heavy compass guy yet).

, - , . , " ". "" . ( , ), , . .

, ...

Google ( , ) , BFS DFS. Steve Skiena , .

+12

, , , . , .

+2

Source: https://habr.com/ru/post/1705439/


All Articles