Homework 3

Homework 3 - W08/CS5592 Homework Three Design and Analysis...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
W08/CS5592 Homework Three Design and Analysis of Algorithms Due: Monday, March 10, 2008, in class There are four problems 1 Find an optimal parenthesization of a matrix chain product whose sequence of dimensions is (8, 10, 6, 11, 3, 35). 2 Re-consider the domino stone problem. Suppose that a sequence of n (> 1) domino stones, s 1 , s 2 , …, s n , are placed horizontally in a row. Each stone s i (1 i n ) has two nonnegative numbers as illustrated by the following figure. 5 6 4 2 9 7 5 7 3 9 11 10 S 1 S 2 S 3 S 4 S 5 S 6 We use arrays L [ i ] and R [ i ] to store the two numbers of s i (1 i n ), where L [ i ] is the number arranged to the left side of R [ i ] in the sequence. For example, in the above sequence, we have L[1] = 5, R[1] = 6, L[2] = 4, R[2] = 2, L[3] = 9, R[3] = 7, L[4] = 5, R[4] = 7, L[5] = 3, R[5] = 9, L[6] = 11, R[6] = 10. If L [ i ] R [ i ], then we say that stone s i is in state 0, denoted by W[ i ] = 0. Otherwise, W[
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Homework 3 - W08/CS5592 Homework Three Design and Analysis...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online