Describe the standard O(n^3) time dynamic programming algorithms for solving the matrix chain problem. You should describe all the necessary terms, derive a recurrence relation, and then outline the algorithm and its time complexity.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Describe the standard O(n^3) time dynamic programming algorithms for solving the matrix chain problem. You should describe all the necessary terms, derive a recurrence relation, and then outline the algorithm and its time complexity.

Expert Solution
Step 1

Dynamic programming: Matrix Chain Multiplication

Description In this assignment you are asked to implement a dynamic programming algorithm for the matrix chain multiplication problem , the goal is to find the most computationally efficient matrix order when multiplying an arbitrary number of matrices. in a row. you can assume that the entire input will be given as integers that can be stored using the standard C++ int type and that matrix sizes will be at least 1.

Input The input has the following format. The first number, n1, in the test case will tell you how many matrices are in the sequence. The first number will be then followed by n+1 is enough to fully specify the dimensions of the multiplied.

Output First you need to output the minimum number of scalar multiplication needed to multiply the given matrices. Then, print the matrix multiplication sequence, via parentheses, that minimizes the total number of number multiplication. 

Each matrix should be named A#, where # is the matrix number starting at 0 (zero) and ending at n-1. see the examples below.

 

Step 2

Examples of input and output:

2

2 3 5

30

(A0A1)

3

10 10)A2)

6

30 35 10 5 50

7500

((A0A1)A2)

3

10 30 5 60

4500

((A0A15 5 10 20 25

15125

((A0(A1A2))((A3A4)A5))

Recurrence relation:

A recurrence relation is an equation that uses recursion to relate terms in a sequence or elements in an array. It is a way to define a sequence or array in terms of itself. Recurrence relation have application in many areas of mathematics:

Sometimes, a recurrence relation can be "solved" by defining the terms of a sequence in terms of its index rather than previous terms in the sequence. This given a closed form expression for each term in the sequence and eliminates the need for an iterative process to solve for terms in the sequence. there are several ways to accomplish this:

Solving linear recurrence relations

solving recurrence relations with generating functions

solving recurrence relation with the substitution method

solving recurrence relation with the method of summation factors.

Even if the solution of this form is not possible, a recurrence relation is still useful, as it can use to develop computer algorithms. When terms in a sequence are stored, dynamic programming allows one to compute new terms in a sequence efficiently. Recurrence relation is also applicable for recursive backtracking, in which recursion is used to optimize algorithms.

 

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Matrix Chain Multiplication
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education