Author | Message |
---|---|
kevinmowers@yahoo.com
Posts: 49
|
Posted 20:17 Dec 07, 2014 |
4. Not counting the graph itself, the stack used to keep track of subprogram calls, the explored set, or the visited list, the maximum amount of non-local storage needed for Graph.search doing BFS is the number of nodes
the number of edges the maximum number of neighbors for any one node 0 **Is the answer to problem 4 'a : the number of nodes', because at the end of the search, all the nodes will be in explored?
5. Not counting the graph itself, the stack used to keep track of subprogram calls, the explored set, or the visited list, the maximum amount of non-local storage needed for Graph.search doing DFS is the number of nodes
the number of edges the maximum number of neighbors for any one node 0 **I don't understand why the the maximum amount of storage isn't the number of nodes. At the end of the search for a worst case scenario, all of the nodes would be explored eventually.
6. Not counting the graph itself, the stack used to keep track of subprogram calls, the explored set, or the visited list, the maximum amount of non-local storage needed for Graph.dfs (the recursive version of depth-first-search) is the number of nodes
the number of edges the maximum number of neighbors for any one node 0 **I got this right, but I don't understand why it would be 0
7. The code for Graph.dfs must include both of the following lines. visited.add(n); // line a and explored.add(n); // line b In the code, line a must precede line b
line b must precede line a either line a or line b can come first neither line a nor line b can come first **When searching by dfs, the program visits the node to see what edges are related to it, then it explores that node. I don't know why 'a' would be wrong Please help, thank you! |
mnava18
Posts: 86
|
Posted 20:25 Dec 07, 2014 |
for 7 , the answer is choice 3 because your adding a and b ,it doent matter which comes first.t |
rabbott
Posts: 1649
|
Posted 21:11 Dec 07, 2014 |
|
vsluong4
Posts: 87
|
Posted 21:52 Dec 07, 2014 |
Either I took too many English classes, or I didn't take quite enough. |
kevinmowers@yahoo.com
Posts: 49
|
Posted 21:56 Dec 07, 2014 |
This was mentioned a while ago |