i ][ j ], ▁in A Result ); ▁▁▁▁▁▁▁▁▁▁▁▁ ▁print Opt imal Par enth es izations ( s , ▁s [ i ][ j ] ▁+ ▁ 1 , ▁j , ▁in A Result ); ▁▁▁▁▁▁▁▁▁▁▁▁ ▁String ▁is tr ▁= ▁in A Result [ i ] ▁? ▁"_ result ▁" ▁: ▁" ▁"; ▁▁▁▁▁▁▁▁▁▁▁▁ ▁String ▁j str ▁= ▁in A Result [ j ] ▁? ▁"_ result ▁" ▁: ▁" ▁"; ▁▁▁▁▁▁▁▁▁▁▁▁ ▁System . out . println (" ▁A _" ▁+ ▁i ▁+ ▁is tr ▁+ ▁"* ▁A _" ▁+ ▁j ▁+ ▁j str ); ▁▁▁▁▁▁▁▁▁▁▁▁ ▁in A Result [ i ] ▁= ▁true ; ▁▁▁▁▁▁▁▁▁▁▁▁ ▁in A Result [ j ] ▁= ▁true ; ▁▁▁▁▁▁▁▁ ▁} ▁▁▁▁ ▁} ▁} ▁ ▁At ▁the ▁end ▁of ▁this ▁program , ▁we ▁have ▁the ▁minimum ▁cost ▁for ▁the ▁full ▁sequence . ▁ ▁More ▁efficient ▁algorithms ▁ ▁There ▁are ▁algorithms ▁that ▁are ▁more ▁efficient ▁than ▁the ▁O ( n 3 ) ▁dynamic ▁programming ▁algorithm , ▁though ▁they ▁are ▁more ▁complex . ▁ ▁Hu ▁& ▁Sh ing ▁( 1 9 8 1 ) ▁ ▁An ▁algorithm ▁published ▁in ▁ 1 9 8 1 ▁by ▁Hu ▁and ▁Sh ing ▁ach ieves ▁O ( n   log   n ) ▁computational ▁complexity . ▁ ▁They ▁showed ▁how ▁the ▁matrix ▁chain ▁multiplication ▁problem ▁can ▁be ▁transformed ▁( or ▁reduced ) ▁into ▁the ▁problem ▁of ▁tri ang ulation ▁of ▁a ▁regular ▁polygon . ▁ ▁The ▁polygon ▁is ▁orient ed ▁such ▁that ▁there ▁is ▁a ▁horizontal ▁bottom ▁side , ▁called ▁the ▁base ,