comparison/benchmarks of the 1) naive method, which just calls max with every new index, up to size of array - k 2) my method , which only makes a call to max if the old max is out of range or the newest/very rightmost element is greater than max
ruby code: [image: max_subarray_text.png] benchmark output: [image: max_subarray_output.png] To test this, I had shuffled an array of size 1000 with k=25. I also called each method 1000 times, which shows 5x improvement over naive method icy` -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
<<max_subarray_output.png>>
<<max_subarray_text.png>>