From 90b7cbacc6080932a18f907c07f338ca38e3e404 Mon Sep 17 00:00:00 2001 From: AyushYadav29 <56931013+AyushYadav29@users.noreply.github.com> Date: Wed, 23 Oct 2019 23:01:08 +0530 Subject: [PATCH] Added Matrix Chain program in java Problem: Given a sequence of matrices, find the most efficient way to multiply these matrices together. The problem is not actually to perform the multiplications, but merely to decide in which order to perform the multiplications. --- DynamicProgramming/Matrix_Chain_Mul.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 DynamicProgramming/Matrix_Chain_Mul.java diff --git a/DynamicProgramming/Matrix_Chain_Mul.java b/DynamicProgramming/Matrix_Chain_Mul.java new file mode 100644 index 0000000..4f0aaf8 --- /dev/null +++ b/DynamicProgramming/Matrix_Chain_Mul.java @@ -0,0 +1,24 @@ +public class Matrix_Chain_Mul { +static int Rec_matrix_chain(int dim[], int i, int j) +{ +if (i == j) +return 0; +int min = Integer.MAX_VALUE; +for (int k=i; k