Talk:VList: Difference between revisions

m
(Oops.. fraction upside down.)
Line 31:
::::::: Hmm? If you want to make a reference to a slice of the array, just copy the pointer and set a new offset, which is O(1). If you need to copy the content, then every block that's not empty should be copied, which involves all n elements that's currently filled. The point of taking a slice reference is to avoid this copying. --[[User:Ledrug|Ledrug]] 18:26, 13 September 2011 (UTC)
:::::::: Hmm.. ok... But you need to be careful about the set of allowed operations on a slice. For example, think about what happens to a slice that omits the first character of the original and then what happens when you add another character. Note that if you add to the slice, the behavior of the original is different if it was length 2 vs. if it was length 6. Something analogous can happen with cloning: with a suitably restricted set of operations (if adding is allowed but not dropping) you do not have to clone the entire set of data and can clone only the first block. --[[User:Rdm|Rdm]] 19:50, 13 September 2011 (UTC)
::::::::: I think the task is strangely described: the algorithm is nowhere specified, and instead there is a specification to have the code function at O(1) or similar speed. Is there any available linked-list code that at least meets the speed specifications from which I can pull an algorithm? --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 02:41, 23 June 2022 (UTC)
4,102

edits