Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: List::BinarySearch and conditional tests with Test::Moreby davido (Cardinal) |
on Nov 30, 2014 at 07:01 UTC ( [id://1108767]=note: print w/replies, xml ) | Need Help?? |
That should be...
The difference from your original suggestion is that one should pass the array by reference. Q: Why would the crazy author want the array parameter to be passed by reference? Doesn't he know this can be inconvenient? :) A: Because passing a list is an O(n) operation, whereas passing a reference is O(1). We wouldn't want the passing of parameters to have an order of growth that is worse than the order of growth of the underlying algorithm. Of course you already know this, but it's worth mentioning in general. Dave
In Section
Seekers of Perl Wisdom
|
|