Вопрос

What is the complexity for Seq.append? Is it O(1) time and space?

I might add that (a) I should certainly hope so, and (b) I failed to google my way to complexity bounds for Seq module members. If someone know of such, I'd love to have a link to it.

EDIT. I did check the source code before asking. The implementation is here, which will make you look, eventually, at this function, the implementation of which is not immediately accessible to me, and the comments before which puzzles me.

Это было полезно?

Решение

Yes, it is O(1) because it basically just create a new object that encapsulates the two original sequences.

See source code here

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top