If you don't think about the underlying implementation of erlang:length(), this seems to me like an easy mistake to make.
Lots of data structures keep a size field and access it in O(1), so it's not completely unreasonable to expect erlang:length to be O(1) without making sure.
At least that's how I understood the context of the problem, I may be wrong of course.
Lots of data structures keep a size field and access it in O(1), so it's not completely unreasonable to expect erlang:length to be O(1) without making sure.
At least that's how I understood the context of the problem, I may be wrong of course.