📗 Enter your ID (the wisc email ID without @wisc.edu) here: and click (or hit enter key) 1,2,3,4,5,6,7,8,9,10m9
📗 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.
📗 [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] 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): .
📗 [4 points] There are lights in a row. The initial state is , 0 is "off", 1 is "on". A valid move finds two adjacent lights where one is on and the other is off, and switches them while keeping all other lights the same. That is, locally, you may do 01 to 10 or 10 to 01. What is the smallest number of moves to reach the goal state .
Hint
See Fall 2013 Final Q20, Fall 2010 Midterm Q4. "Moving" a light from position \(i\) to position \(j\) requires at least \(j - i\) steps. All the lights need to be moved from the current position to the "correct" position specified by the goal state.
📗 Answer: .
📗 [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:
graph
📗 Note: to erase an edge, draw the same edge again.
📗 [2 points] Recall in uniform-cost search, each node has a path-cost from the initial node (sum of edge costs along the path), and the search expands the least path-cost node first. Consider a search graph with \(n\) = nodes: \(1, 2, ..., n\). For all \(1 \leq i < j \leq n\), there is a directed edge from \(i\) to \(j\) with an edge cost . The initial node is 1, and the goal node is \(n\). How many (unique) goal-checks (the same nodes expanded twice is counted only once) with uniform-cost search perform? Break ties by expanding the node with the smaller index first.
Hint
See Fall 2016 Final Q2. Draw the graph with a small \(n\) and find the pattern. Since there is a node between node 1 and every other node, all nodes with an edge cost to node 1 that is less than the minimum cost of the whole graph (or equal to the minimum cost and with a smaller index) will be visited at least once during UCS. Here, all nodes satisfy this condition, so all \(n\) of them will be visited.
📗 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.
📗 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.