From 31a9aeaa4a64a63e38205650d08b3e295d67c9c6 Mon Sep 17 00:00:00 2001 From: Sanchit Gupta Date: Wed, 10 Oct 2018 14:45:46 +0530 Subject: [PATCH] Matrix Chain Multiplication Added --- .../Matrix_Chain_Multipliaction.cpp | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Matrix Chain Multiplication (MCM)/Matrix_Chain_Multipliaction.cpp diff --git a/Matrix Chain Multiplication (MCM)/Matrix_Chain_Multipliaction.cpp b/Matrix Chain Multiplication (MCM)/Matrix_Chain_Multipliaction.cpp new file mode 100644 index 0000000..6d25a6e --- /dev/null +++ b/Matrix Chain Multiplication (MCM)/Matrix_Chain_Multipliaction.cpp @@ -0,0 +1,75 @@ +#include +#include +using namespace std; +long int m[50][50],p[50],s[50][50]; +void matrix_chain(int n){ +long int i,j,k,l,q; +for(i=1;i<=n;i++) +{ + m[i][i]=0; +} +for(l=2;l<=n;l++) +{ + for(i=1;i<=n-l+1;i++) + { j=i+l-1; + m[i][j]=20000; + for(k=i;k>n; + cout<<"Enter Order Array:"<>p[i]; +} + matrix_chain(n); + cout<<"M Table : "<