[erlang-questions] is length(L) fast?

Gleb Peregud gleber.p@REDACTED
Wed Jan 4 17:47:04 CET 2012


On Wed, Jan 4, 2012 at 17:38, Zabrane Mickael <zabrane3@REDACTED> wrote:
> Is the call to length(L) traverse all the list ?

Yes, it does. Lists are single-linked lists

> or is it something already pre-computed internally (i.e constant time =
> fast)?

It's O(n) where n is length of the list.



More information about the erlang-questions mailing list