Homework #5 -- due Wednesday Wk 6

# required problems topic
1 CLR Exercise 28.2-4 on page 741 Strassen
2 CLR Problem 30-1(b) on page 844 D+C multiplication

# suggested problems topic
3 Baase Exercise 10.6 on page 476 product of matrix chain
4* Consider the following extension of the Towers of Hanoi problem, in which there are four pegs A, B, C, and D, and n squares of varying sizes.  Initially the squares are stacked on peg A in order of decreasing size, the largest square on the bottom.  The problem is to move the squares from peg A to peg B one at a time in such a way that no square is ever placed on a smaller square.  Pegs C and D may be used for temporary storage of squares. Write an efficient recursive algorithm to solve this problem.  What is the execution time of your algorithm in terms of the number of times a square is moved? recursion


Dan Hirschberg
Computer Science Department
University of California, Irvine, CA 92697-3435
dan at ics.uci.edu
Last modified: Jun 18, 2008