algorithm analysis - = ( )( ( )( = ( = = = ( )( ( nn we can avoid the cubic running time by removing for loop this is not always possiblebut in this case there are an awful lot of unnecessary computations present in the algorithm the inefficiency that the improved algorithm corrects can be seen by noticing  -  that = ak aj = ak so the computation at lines and in algorithm is unduly expensive figure shows an improved algorithm algorithm is clearly ( )the analysis is even simpler than before there is recursive and relatively complicated ( log nsolution to this problemwhich we now describe if there didn' happen to be an ( (linearsolutionthis would be an excellent example of the power of recursion the algorithm uses "divide-andconquerstrategy the idea is to split the problem into two roughly equal subproblems /*quadratic maximum contiguous subsequence sum algorithm *int maxsubsum const vector int maxsum forint size)++ int thissum forint ij size)++ thissum +aj ]ifthissum maxsum maxsum thissumreturn maxsumfigure algorithm