Answered! Show transcribed image textConsider the following graph. Starting at root node 1, give the order by using the depth-first algorithms and Breadth-First-Search…

Show transcribed image textConsider the following graph. Starting at root node 1, give the order by using the depth-first algorithms and Breadth-First-Search

Expert Answer

 BFS, is a traversing algorithm where, starting from root node, the same layer nodes are traversed first, so

it will start at 1->2->3->4->5->6

this first, layer 1 ia traversed, then layer 2 is traversed from left to right. and so on.

DFS is a recursive algorithm that uses the idea of backtracking. It means that first, you move from top node and continue on the current path, then move backwards on the same path, finding the nodes to traverse.

1->2->4->5->3->6

Still stressed from student homework?
Get quality assistance from academic writers!