Re: Sliding window
"filia&sofia" <in_tyrannos@hotmail.com> wrote in message
news:33c37d38-9ce4-4fb0-8d5d-d14fbf823a00@n14g2000pri.googlegroups.com...
>
>> He says that he wants to avoid using "for" because it's
>> a "slow operation." Go figure.
> Nested k-level for-loops have time complexity of O(n^k).
> O(n) algorithms' time complexity increases linearly.
I don't fully understand the O() notation, but I have a feeling the above is
nonsense.
Anyway a for-loop isn't that slow, there's a small overhead per iteration,
which may be insignificant depending on what's in the loop. And there are
ways of minimising that overhead.
But I doubt what you need will involve deeply nested for-loops.
Post some code here (using any method including for-loops) and we'll see if
it needs to be improved.
--
Bart
|