This is true in all implementations of ML that I am aware of, though I certainly would believe that it's possible to create an implementation for which that is not the case.
Is appending to lists in Standard ML O(n) time?
-
11-10-2022 - |
Frage
I'm trying to insert elements at the end of a list, but I'm wondering if that would be slow?
I know that to append elements in Scheme requires traversing the entire list and thus O(N) time for a list of length N. Is that also true in ML?
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow