Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of Matrix Chain Multiplication #412

Merged
merged 13 commits into from
Nov 10, 2024
Merged

Conversation

shuvojitss
Copy link
Contributor

Matrix Chain Multiplication

Description

Given a chain of matrices with specified dimensions, the algorithm computes the optimal order to perform matrix multiplications, minimizing computational cost. The solution uses a dynamic programming table to store intermediate results, which avoids redundant calculations and improves efficiency. Users input the number of matrices and their respective dimensions, and the program outputs the minimum multiplication cost required to multiply the entire chain.

Example

Input :

Enter the number of matrices: `4`
Enter the dimensions of matrices (n+1 integers where nth matrix has dimensions arr[i] x arr[i+1]): `5 10 15 20 25`

Output:

Minimum number of multiplications required for the matrices multiplication is 4750

Closes Issue:

#411

Test Run:

Screenshot 2024-11-09 132133

Copy link
Contributor

github-actions bot commented Nov 9, 2024

👋 Thank you for opening this pull request! We're excited to review your contribution. Please give us a moment, and we'll get back to you shortly!

Feel free to join our community on Discord to discuss more!

@shuvojitss
Copy link
Contributor Author

@UTSAVS26 Please review and approve my pull request.

@shuvojitss
Copy link
Contributor Author

@UTSAVS26 Resolved

@shuvojitss
Copy link
Contributor Author

@UTSAVS26 resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants