Talk:VList: Difference between revisions

(→‎Some problems: persistent)
Line 25:
:::(b) The time to complete the operation is O(n) rather than O(1).
::And... without this issue, these performance characteristics can be achieved with regular arrays (or, for a language like C: a structure which consists of a pointer to an array, the currently used array length and the currently allocated array length -- when you need more space, use realloc to double the allocated space -- and subtract the index you are using from the length of the array to achieve the "add to front" semantics of the VList). This flat array approach results in a simpler algorithm and significantly lower constant factors when reading the data. --[[User:Rdm|Rdm]] 15:01, 13 September 2011 (UTC)
::: Sure, but VList is meant to give persistent pointers. Realloc may move buffer and invalidate all pointers into its elements, while VList would not. --[[User:Ledrug|Ledrug]] 15:31, 13 September 2011 (UTC)
Anonymous user