lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Philippe Lhoste wrote:
> [...]
> > I disagree. What you call "same algorithm" is actually a naive rewriting
> > of a language idiom into another language.
> 
> Respectfully, that's *why* it's the same algorithm. If you rewrote it to use a
> more appropriate language idiom, it would be a different algorithm, more or
> less by definition.

I may be wrong, but as far as I know time complexity is an intrinsic
property of an algorithm. So, if something runs in O(n) and something
else runs in O(n^2), they cannot be the same algorithm.

-- Roberto