[algogeeks] Re: Find the Max from each sub-array of size k Options
I apologize to the group; i meant to post as reply to "Find the Max from each sub-array of size k" but I accidentally selected the word "Options" as well. Sorry. On Sep 2, 3:42 pm, "icy`" wrote: > 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` > > max_subarray_output.png > 3KViewDownload > > max_subarray_text.png > 26KViewDownload -- 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.
Re: [algogeeks] Re: Find the Max from each sub-array of size k
for(i=0;iwrote: > we can do it using max heap > > -- > 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. > > -- 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.
[algogeeks] Re: Find the Max from each sub-array of size k
we can do it using max heap -- 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.