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

# M9 Written (Math) Problems

📗 Enter your ID (the wisc email ID without @wisc.edu) here: and click (or hit enter key)
📗 The official deadline is August 1, but you can submit or resubmit without penalty until August 10.
📗 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.
📗 Please report any bugs on Piazza.

# 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



📗 [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 breadth first search (BFS) 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 same person visited multiple times are counted as multiple visits) the algorithm needs to visit (including Alice and Bob)?
Hint See Fall 2018 Midterm Q1, Fall 2016 Midterm Q1, Fall 2010 Final Q3. 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: .
📗 [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): .
📗 [2 points] Consider a 3-puzzle where, like in the usual 8-puzzle game, a tile can only move to an adjacent empty space. Tiles cannot move diagonally. Which of the following initial states can reach the goal state (0 means "no tile")?
Hint See Fall 2018 Midterm Q3. Since there are only four tiles, there is no way to change the ordering of the tiles: starting from 0, write down the numbers from the matrix in the clockwise order, the ones that are the same as the goal state can reach the goal state.
📗 Choices:





None of the above
📗 [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.
📗 [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 graph which is a tree, and each internal node has children. The only goal node is at depth (root is depth 0). How many total goal-checks will be performed by Iterative Deepening Search in the luckiest case (i.e. the smallest number of goal-checks)? If a node is checked multiple times you should count that multiple times.
Hint See Fall 2018 Midterm Q5. When the depth limit is \(i\), every node in the tree limited to depth \(i\) are searched, so \(\displaystyle\sum_{i'=0}^{i} b^{i'}\) nodes are searched in iterations \(i = 0, 1, ..., d - 1\). In the luckiest case, the goal node is on the first path when the depth limit is \(d\), so at least \(d + 1\) nodes are searched in iteration \(i = d\).
📗 Answer:
📗 [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:
📗 [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: .
📗 [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


 ***** ***** ***** ***** ***** 

 ***** ***** ***** ***** *****

# Submission


📗 Please do not modify the content in the above text field: use the "Grade" button to update.


📗 Please wait for the message "Successful submission." to appear after the "Submit" button. If there is an error message or no message appears after 10 seconds, please save the text in the above text box to a file using the button or copy and paste it into a file yourself and submit it to Canvas Assignment M9. You could submit multiple times (but please do not submit too often): only the latest submission will be counted.
📗 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.



# Solutions

📗 Some of the past exams referenced in the Hints can be found on Professor Zhu's and Professor Dyer's websites: Link and Link.
📗 Some of the questions are from last year, and I recorded videos going through them, the links are at the bottom of the Week 1 to Week 8 pages, for example: W4 and W8.
📗 The links to the solutions the students volunteered to share on Piazza will be collected in this post around the official deadline: Link.





Last Updated: April 29, 2024 at 1:11 AM