Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7177355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:41:45+00:00 2026-05-28T16:41:45+00:00

This is a solved problem in Introduction to Algorithms, by Cormen, et. al. Ch.

  • 0

This is a solved problem in “Introduction to Algorithms”, by Cormen, et. al.
Ch. 15, Section 15.2: Matrix Chain Multiplication. Pg. 373.

The objective is to parenthesize the matrix chain product A1.A2.A3…..An such that there are minimum number of scalar multiplications.
For Ai.Ai+1….Ak.Ak+1…..Aj,
Matrix Ai has dimension pi-1xpi
The author comes up with the recursion

m[i,j] = 0 if i=j
       = min {m[i,k] + m[k+1] + pi-1.pk.pj}   where i goes from k to (j-1)   if i<j

(m[i,j] is the minimum number of scalar multiplications required for the product Ai….Aj)

So far I understood, but then the time complexity he says is O(n^3).
When I look at the pseudo-code, there are 3 for loops, so its correct. But I don’t understand this intuitively by looking at the recursion.

Can anyone please help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:41:47+00:00Added an answer on May 28, 2026 at 4:41 pm

    The final solution is to calculate m[0,N]. But all m[i,j] values need to be calculated before m[0,N] can be calculated. This makes it O(N^2).

    From the recursion formula you can see each m[i,j] calculation needs O(N) complexity.

    So O(N^3) for the complete solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have solved this problem, I just need to know what to do. I
I know I've solved this problem before, but I can't remember or find the
I'm curious how others have solved this problem, and what problems might lurk behind
The responses I've got to this question have solved the problem I had in
Update II Problem Solved but Why? This has been the biggest headache ever. My
UPDATE: First problem solved, second one described at the bottom of this post. UPDATE2:
This is not really a question because I just solved the problem, but I
This problem has been solved thanks to your suggestions. See the bottom for details.
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
This problem has been solved! Thanks a lot to Brad, Denis and junkie! You're

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.