Question: Data Structure class 29. List the pre-order enumeration that the vertices in the graph below are visited in a depth-first search (DFS) and a breadth-first
29. List the pre-order enumeration that the vertices in the graph below are visited in a depth-first search (DFS) and a breadth-first search (BFS), starting from swertex 0. DFS: BFS: 30. In the implementation for a breadth-first scarch we stulied, a queue was used. The code below replaces the queue with a stack. List the pre-order enumuration that the vertions in the graph below are visited using this modified method, starting from vertex 0 . modSearch: /** stack-based search */ static void modSearch (Graph G, int start) \& StackS = new AStack(G.nO); S. push (atart): G. setMark (atart, VISITED); while ( s.length )>0)1 int v= s.pop(); PreViait (G, v) : for (int v= G.firat (v);v
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
