{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

6ehw2 - minimum number of scalar multiplications needed to...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
National Taiwan University Handout #9 Department of Electrical Engineering October 29, 2009 Algorithms, Fall 2009 Yao-Wen Chang Name: Student ID: Web ID: Problem 1. (24 pts total) Given four matrices A 1 , A 2 , A 3 , A 4 of dimensions 3 × 1 , 1 × 2 , 2 × 5 , 5 × 7, respectively. (a) (18 pts) Fill every field in the m and s tables, where m [ i, j ] gives the minimum number of scalar multiplications needed to compute A i A i +1 . . . A j and s [ i, j ] records the value of k such that the optimal parenthsization of A i A i +1 . . . A j splits the product between A k and A k +1 . (a) (6 pts) Find an optimal parenthesization of the matrix-chain product A 1 A 2 A 3 A 4
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: minimum number of scalar multiplications needed to compute the chain. Problem 2. (24 pts total) The figure below shows a binary tree. (a) (8 pts) Label the tree with numbers from the set { 1 , 2 , 4 , 5 , 6 , 7 , 8 } so that it is a legal binary search tree. (b) (8 pts) Label each node in the tree with R or B denoting the respective colors RED and BLACK so that the tree is a legal red-black tree. (c) (8 pts) Give the red-black tree that results from inserting the key 3 into the tree of (b)....
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern