Time complexity of list-length
common-lisp, complexity-theory, lisp, performance, time-complexity
Solution
Yes.
That's exactly right and I'm writing this sentence, because an answer needs at least 30 characters.
Problem
I think `list-length` is a O(n) complexity operation, since it seems there's no other way to find it but going through all of the list's elements. ``` ;; iterates through list's elements ;; and returns 6, right? (list-length '(1 2 3 4 5 6)) ``` Nevertheless, I'd like to be sure, since it's critical for a work of mine. Is this correct?