Given a family tree if one were looking for someone on the t

Given a family tree if one were looking for someone on the tree who’s still alive, which traversal algorithm among BFS and DFS will be faster? If one were looking for a family member who died a very long time ago, which traversal algorithm among BFS and DFS will be faster? Give reasoning for both answers.

Solution

In the given example above a family tree if one were looking for someone on the tree who’s still alive, A DFS transversal algorithm will be faster whereas a BFS algorithm takes a long time in order to reach the final level.

Whereas if you were looking for a family member who died a very long   time ago then BFS transversal algorithm would be faster when compared with a DFS algorithm.

A BFS just expands the search by one ”step” on every iteration.

Given a family tree if one were looking for someone on the tree who’s still alive, which traversal algorithm among BFS and DFS will be faster? If one were looki

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site