1. - False. Although this is a common base case, other bases cases may make sense, like a list with one item in it, for example rec_max. - True. When the mystery function is called 10 gets associated with the parameter x, but the original x variable also exists and has it's own value. Updating the parameter to 2 in the function does not change the external x variable. - False. It depends on which version of DFS as well as how the next states are returned. 2. a b c output 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 (>= threshold is 1) 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 3. def count_even(list): if list == []: return 0 else: count = count_even(list[1:]) if list[0]%2 == 0: return 1 + count else: return count 4. a. No problem. b. Aliasing problem. c. No problem. d. Aliasing problem. e. No problem. 5. a ---->10 ^ ^ c -----| | d -------| b ----> [1, 2, 3, 4, 5] 6. DFS: No. It will depend on how the state space is searched. If we're not careful, DFS could get stuck searching s -> a -> s -> a ... BFS: Yes. Even though BFS will also explores s -> a -> s -> a ... it will also explore other paths at the same time and will eventually find the solution. 7. Memory. At any given point, BFS has to keep track of an entire row/level of the state space. If the branching factor (number of next states for a given state) is high and/or the goal state is far from the starting state, the row/level can be huge. 8. T/F - False. This is only true if there is a single unique goal state. Otherwise, since they search the state space in different order, they can find different goal states. - False. m[1] represents the second row. m[0] would represent the first row. - False. BFS/DFS could get lucky or, if the heuristic function isn't good, then the informed search algorithm could take longer. 9. def matrix_transpose(m): t = [] for c in range(len(m)): new_row = [] for r in range(len(m)): new_row.append(m[r][c]) t.append(new_row) return t Note if you didn't want to assume that the matrix was square, something like the following would work: def matrix_transpose(m): t = [] rows = len(m) cols = len(m[0]) for c in range(cols): new_row = [] for r in range(rows): new_row.append(m[r][c]) t.append(new_row) return t 10. Set the weights on in1 and in2 to be -1 and the threshold to be -1. If in1 and in2 are both 1, then the weighted sum will be -2 and below the threshold and will output 0. If either in1 or in2 are 0 (or both are) then the weighted sum will be greater than or equal to -1, so it will output 1. 11. i. print(dog) Charlie of type dog and is not hungry ii. print(cat) Lucy of type cat and is hungry iii. print(cat.same_type(cat2)) True