Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

ASSIGNMENT # 3

Complex Computing Problem (CCP)


Matrix Chain Problem

Instructor: Amjad Ali Submission: 18-01-24


Subject: Analysis of Algorithms (V5) Semester: F2023
_____________________________________________________________________________________

Given dimensions p0, p1, p2, p3, p4, p5, p6 corresponding to matrices sequence A1, A2, A3, A4, A5,
A6 where Ai has dimension pi-1 x Pj.

A1 (20 × 5)
A2 (5 × 40)
A3 (40 × 55)
A4 (55 × 12)
A5 (12 × 30)
A6 (30 × 23)

Determine the “multiplication sequence” that minimizes the number of scalar multiplications in
computing A1 A2 A3 A4 A5 A6. That is, determine how to parenthesize the multiplications.

A. Solve the above problem by


a) Dynamic Problem – Bottom-Up Version
1. Establish a Recursive Property that gives the optimal solution to an
instance of the problem
2. Compute the value of an optimal solution in a bottom-up fashion
3. Construct an optimal solution in a bottom-up fashion from computed
information.
b) Dynamic Problem – Top-Down Version (Memoized)

B. Construct sub-problem graphs of both versions and compare them.

C. What is the time complexity of the Chain Matrix Problem for


i. Bottom-up version (Dynamic Programming)
ii. Top-down version - (Dynamic Programming) - Memoized
iii. Brute Force version
iv. Divide and Conquer version

You might also like