ie multiplication single matrices therefore next step actually split chain ie place parenthesis optimally belong purpose could use following algorithm '''function''' printoptimalparenthesis j '''if''' j print '''else''' print printoptimalparenthesis j printoptimalparenthesis j j print course algorithm useful actual multiplication algorithm user friendly way see result looks like actually multiply matrices using proper splits need following algorithm syntaxhighlight lang javascript function matrixchainmultiply chain
Applied science Transportation Operations research Dynamic programming