CS451/551 Homework 1 - due Friday February 8, 2002 ----------------------------------------------------- You may work in groups of two if you like. You need to write search algorithms for the following problems: 1. Maze Problem 2. Tiling Problem 3. Geography Problem 4. PCP Problem Here is a description of each of the problems: Maze Problem: You have a grid. Some squares in the grid are considered to be legal spots. There is a designated initial square, and a designated final square. The problem is to find a path from the initial square to the final square, or to say that one does not exist. At each point, you may move up, down, left or right one square, and you may only go to legal squares. Tiling Problem: You have a grid. You also have a set of dominoes. Each domino has a four numbers on it: one on top, one on the bottom, one on the left and one on the right. The problem is to place dominoes on all squares of the grid, such that numbers that touch each other are the same. You are allowed to use each domino as many times as you want. Geography Problem: You have a set of words. A list of words in legal if the last letter of each word is the same as the first letter of the following word. The problem is to find a legal list of words using all the words exactly once. (The easiest is to represent a word as a list of letters) PCP Problem: You have a set of dominoes. Each one contains a string on the top and a string on the bottom. The problem is to find a sequence of dominoes of dominoes such that the concatenation of the strings on the top gives the same string as the concatenation of all the strings on the bottom. Dominoes may be used as many times as you want. I have a generic DFS search algorithm at http://www.clarkson.edu/~clynch/cs451/spring02/solve.lsp The DFS search algorithm is defined so that it fails when it finds a duplicate state as an ancestor, but not when it finds a duplicate state elsewhere in the tree. You should use my search algorithm, and then all you need to do is to define each individual problem as in the template http://www.clarkson.edu/~clynch/cs451/spring02/mazeprob.lsp For each problem, please do the following: A. Print out your problem definition. B. Print output from some examples. C. Calculate (approximately) the time complexity, space complexity, and completeness of DFS for this problem in terms of variables in the general problem (not for a specific instance of the problem) for the worst case. D. Repeat step C for BFS instead of DFS. E. Give an opinion on whether DFS or BFS is better for this particular problem. F. Give a concrete example that illustrates your opinion on step E. Please ask me questions if you have any. This may seem vague, but I am willing to explain it better if you ask.