[m-rev.] diff 1/3: Add an extra note about costs in version_array.m
Paul Bone
paul at bone.id.au
Tue May 7 11:56:50 AEST 2013
Add an extra note about costs in version_array.m
version_array.m did not document the cost of modifying an old part of the
array. This change adds a simple description.
library/version_array.m:
As above.
---
library/version_array.m | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/library/version_array.m b/library/version_array.m
index e0cf999..609e9a4 100644
--- a/library/version_array.m
+++ b/library/version_array.m
@@ -21,6 +21,10 @@
% then accesses to An cost O(1) (assuming no further versions of the array
% have been created from An), but accesses to A0 cost O(n).
%
+% Updates to older versions of the structure (for example A(n-1)) may have
+% additional costs, for arrays this cost is O(m) where m is the size of the
+% array, as the whole array is copied to make a new version array.
+%
% Most version data structures come with impure, unsafe means to "rewind"
% to an earlier version, restoring that version's O(1) access times, but
% leaving later versions undefined (i.e. only do this if you are discarding
--
1.8.1.3
More information about the reviews
mailing list