Prev: M8 Next: M10
Back to week 6 page: Link

# Warning: this is a replica of the homework page for testing purposes, please use M9 for homework submission.


# M9 Written (Math) Problems

📗 Enter your ID (the wisc email ID without @wisc.edu) here: and click (or hit enter key)
📗 You can also load from your saved file
and click .
📗 If the questions are not generated correctly, try refresh the page using the button at the top left corner.
📗 The same ID should generate the same set of questions. Your answers are not saved when you close the browser. You could print the page: , solve the problems, then enter all your answers at the end.
📗 Please do not refresh the page: your answers will not be saved.

# Warning: please enter your ID before you start!


# Question 1


# Question 2


# Question 3


# Question 4


# Question 5


# Question 6


# Question 7


# Question 8


# Question 9


# Question 10


# Question 11


📗 [4 points] Imagine a world where each person has friends. Alice and Bob are \(d\) = "friendship links" away (i.e. if \(d\) = 1, Alice and Bob are friends; if \(d\) = 2, there is a third person X such that Alice and X are friends, and Bob and X are friends; and so on). Imagine a algorithm that has access to the friendship links. The algorithm starts at Alice and the goal is to find Bob. In the worst case, how many people the algorithm needs to visit (including Alice and Bob)?
Hint See Fall 2018 Midterm Q1, Fall 2016 Midterm Q1, Fall 2010 Final Q3. For both BFS and DFS, if the goal is the "last" node visited, then the number of nodes visited is the same as the total number of nodes in a complete tree with depth \(d\) and branching factor \(b\), which is \(\displaystyle\sum_{i=0}^{d} b^{i}\).
📗 Answer: .
📗 [4 points] Imagine a world where each person has friends. Alice and Bob are \(d\) = "friendship links" away (i.e. if \(d\) = 1, Alice and Bob are friends; if \(d\) = 2, there is a third person X such that Alice and X are friends, and Bob and X are friends; and so on). Imagine a algorithm that has access to the friendship links. The algorithm starts at Alice and the goal is to find Bob. In the best (luckiest) case, how many people the algorithm needs to visit (including Alice and Bob)?
Hint See Fall 2018 Midterm Q5. For BFS, if the goal is the "first" node visited, then the number of nodes visited is the same as the total number of nodes in a complete tree with depth \(d - 1\) plus 1 (the goal node), and branching factor \(b\), which is \(\displaystyle\sum_{i=0}^{d-1} b^{i} + 1\). For DFS, if the goal is the "first" node at depth \(d\), then only the "first" node at each level will be visited, meaning a total of \(d + 1\) nodes will be expanded.
📗 Answer: .
📗 [4 points] Which order of goal check is possible with , without specifying the order of successors when putting them in the queue (i.e. you can rearrange the order of the branches)? That is, if the 2 nodes in the choices can be visited in any order without violating BFS, mark this choice as "possible".
📗 Note: some of the choices may be repeated, if you think the choice is correct, please select all repeated ones as well.

Hint See Fall 2017 Midterm Q13. Children and grandchildren can never be checked before parents and grandparents.
📗 Choices:





None of the above
📗 [2 points] Consider n + 1 = + 1 states. The initial state is 1, the goal state is n. State 0 is a dead-end state with no successors. For each non-0 state i, it has two successors: i + 1 and 0. There is no cycle check nor CLOSED list (this means we may expand (or goal-check) the same nodes many times, because we do not keep track of which nodes are checked previously). How many goal-checks will be performed by Breadth First Search? Break ties by expanding the node with the smaller index first.
Hint See Fall 2017 Final Q24, Fall 2016 Midterm Q2. Draw the tree with a small \(n\) and find the pattern. At depth \(0\), only 0 is search, and at each depth \(d > 0\), 0 is always searched first, then \(d\) is searched.
📗 Answer: .
📗 [2 points] Consider a search tree where the root is at depth 0, each internal node has children, and all leaves are at depth . There is a single goal state at depth . How much (in number of states including the root and the goal) is sufficient so always succeeds? Select all that applies.
Hint See Fall 2017 Midterm Q4, Fall 2017 Midterm Q5, Fall 2016 Final Q1, Fall 2006 Midterm Q6. The worst case is when the goal is the last node at depth \(d\). BFS time complexity: \(\displaystyle\sum_{i=0}^{d} b^{i}\), space complexity: \(b^{d}\). DFS time complexity: \(\displaystyle\sum_{i=D-d+1}^{D} b^{i} + 1\), space complexity: \(\left(b - 1\right) D + 1\). IDS time complexity: \(\displaystyle\sum_{i=0}^{d} \left(d + 1 - i\right) b^{i}\), space complexity: \(\left(b - 1\right) d + 1\). Please check to make sure that these are correct!  
📗 Choices:





None of the above
📗 Calculator: .
📗 [3 points] Let the search space be integers. Each state \(n\) has successors . Write down the shortest path (i.e. the sequence of states) from the initial state 1 to the goal state .
Hint See Fall 2018 Midterm Q2, Fall 2017 Final Q13. Suppose the successors are \(a n, a n + 1, ...\), then start from the goal state \(g\), look at the remainder when \(g\) is divided by \(a\) to figure out which integer is its "predecessor" and do this repeatedly until the initial state is reached.
📗 Answer (comma separated vector): .
📗 [3 points] Consider Iterative Deepening Search on a tree, where the nodes are denoted by numbers. Write down the sequence IDS visited in the order they are expanded (i.e. expansion path). 0 is the initial state and is the goal state. Start with depth limit 0, include the root, and include repeated nodes.
📗 Note: use the convention used in the lectures, push the rightmost (in the diagram) successor into the stack first or enqueue the leftmost (in the diagram) successor into the queue first.

Hint See Fall 2018 Midterm Q5, Spring 2018 Midterm Q1, Fall 2006 Final Q1, Fall 2005 Final Q1. Start with 0, then DFS on the tree with depth 1, then DFS on the tree with depth 2, ...
📗 Answer (comma separated vector): .
📗 [3 points] Consider on a tree, where the nodes are denoted by numbers. The search visited the following sequence of nodes (expansion path): . Reconstruct one possible tree. \(0\) is the initial state and is the goal state. You must include all nodes from \(0\) to .
Hint See Fall 2018 Midterm Q5. Every time node 0 is checked, DFS restarts with depth increased by one. Split the expansion path by the 0s to figure out which nodes are at each depth, and draw the tree accordingly.
📗 Answer: 


📗 Note: to erase an edge, draw the same edge again.
📗 [3 points] In a by grid, Tom is located at (, ) and Jerry is located at (, ). Tom uses to find Jerry and the successors of a state (one cell in the grid) are the four neighboring states on the grid (the cells above, below, to the left and to the right). What is the imum number of states that need to be expanded to find (and expand) the goal state? The order in which the successors are added can be arbitrary. Include both the initial and the goal states.
Hint First compute the depth \(d\) of the goal state by finding the Manhattan distance between the initial state and the goal state. For BFS, the best case is that the goal state is the first one at depth \(d\), so all states within a Manhattan distance of \(d - 1\) are expanded, and the worst case is that the goal state is the last one at depth \(d\), so all states within a Manhattan distance of \(d\) are expanded. For DFS, the best case is that the shortest path from the initial state and the goal state is expanded, and the worst case is every state is expanded.
📗 Highlight one example state expansion path (order does not matter).
📗 Answer: 



📗 [4 points] Suppose the state space has \(n\) = states that form a tree with root state \(0\). What is the shape of the tree that makes iterative deepening realize that a goal does not exist as quickly as possible (i.e. one that minimizes the number of expanded nodes)? Draw one example of such a tree.
Hint IDS repeats a smaller number of state expansions for trees with a smaller depth. A tree with the minimum possible depth containing all \(n\) states has depth \(1\).
📗 Answer:


📗 [1 points] Please enter any comments and suggestions including possible mistakes and bugs with the questions and the auto-grading, and materials relevant to solving the questions that you think are not covered well during the lectures. If you have no comments, please enter "None": do not leave it blank.
📗 Answer: .

# Grade


 * * * *

 * * * * *


📗 You could save the text in the above text box to a file using the button or copy and paste it into a file yourself
📗 You could load your answers from the text (or txt file) in the text box below using the button . The first two lines should be "##m: 9" and "##id: your id", and the format of the remaining lines should be "##1: your answer to question 1" newline "##2: your answer to question 2", etc. Please make sure that your answers are loaded correctly before submitting them.








Last Updated: November 30, 2024 at 4:34 AM