Talk:Dynamic array

message: I thought that the overview section should be kept.  Dynamic array is obviously an array data structure.  I am not clear about the edit that states "dynamic array is not strictly an array data structure". MegaHasher 06:56, 28 July 2007 (UTC)
replies: text: I suppose this depends on how you define "array." It's certainly not "obvious" that it is, since an array is frequently defined as a fixed-size data structure. Dcoetzee 03:55, 1 August 2007 (UTC)

text: The cost is n2 with naive expansion for every insertion. This is the point. Dcoetzee 03:56, 1 August 2007 (UTC)
thread_title: Overview

message: This topic has many instances of the 'we' pronoun.  Who's 'we'?  Is this a recommended style for encyclopedic article? MegaHasher 07:10, 28 July 2007 (UTC)
replies: text: My fault. Feel free to fix. I'll fix eventually if you don't. Dcoetzee 10:33, 28 July 2007 (UTC)

text: 'the "inclusive we" widely used in professional mathematics writing is sometimes used to present and explain examples in articles, although discouraged on Wikipedia' -- WP:PRONOUNS, via MOS:WE. --DavidCary (talk) 19:56, 12 February 2022 (UTC)
thread_title: We

message: Okay, here's a list of some things that were modified by recent changes that I changed:
* Dynamic arrays are not supplied with "most standard libraries"; they are not supplied with C, or ML, or Fortran, or Pascal, or countless other standard libraries. The qualifier modern mainstream programming languages is necessary and should not have been removed.
* I don't like use of the ambiguous term static array, which variously means either compile-time allocated array or fixed-size array, so I've eliminated it.
* The text no longer makes a clear distinction between the underlying fixed-size storage and the variable-size storage used for the contents of the dynamic array and no longer clearly explains the concept of capacity. I added a section to more clearly explain this before launching into the discussion of geometric expansion, which is another matter entirely.
* Restored the slightly pedantic explanation that n insertions take O(n) time, under the assumption that people viewing this will not be already familiar with amortized analysis.
* Recent discussion at Talk:Array established that material related to insertion and deletion of elements in fixed-size arrays, and comparison to linked lists, was more appropriate for this article. All this material was subsequently removed. It has to go somewhere - it is referenced here in two places from array. Restored this.
* Text was removed noting that wasted cells were a disadvantage over fixed-size arrays. Restored.
* Discussion of variants was removed, such as the deque variant - it appears that at least some of it was moved to Deque#Dynamic_array_implementation. Linking it properly and expanding it with removed material in the new location. Deques are not strictly speaking "built on top of" dynamic arrays, since this variant changes how the basic data structure is implemented (either the elements are placed in the middle or a circular buffer is used).
* Brief summary of gap buffer doesn't hurt.
* realloc() does not implement dynamic arrays. Where are the insertion and deletion operations? Where are the amortized cost guarantees? realloc() can be used to implement dynamic arrays, but isn't even needed for that (malloc, free, and memcpy are enough). realloc() need not be mentioned here at all.
Changes you guys made that I liked:
* Merging the time-space tradeoff stuff into the discussion. Didn't need its own section.
* Moving deque-related stuff out to deque.
* Removal of the pronoun "we" - bad habit.
* General briefening of some verbose explanation.
Please discuss if you disagree. Dcoetzee 05:23, 1 August 2007 (UTC)
thread_title:  Recent changes 

message: This page should be merged with Vector (STL).  Vector (STL) talks about an implementation of a dynamic array, and most of the content on that page applies to all dynamic arrays.  71.51.124.230 (talk) 19:29, 5 January 2008 (UTC)
thread_title:  Merger proposal 

message: In the chart in the performance section it says that dynamic arrays have a wasted space of Θ(n).  I believe that the vector only need a start and end pointer ( size or other ).  This makes the required wasted space linear.  There are of course optional things such as extra allocated space but those are not in the definition (and still linear).  — Preceding unsigned comment added by Youarefunny (talk • contribs) 19:40, 16 June 2011 (UTC)
replies: text: The linear wasted space is with reference to the most common dynamic array data structure in which geometric expansion of an underlying array is used. In this case wasted space is linear. For example, when the doubling factor is 2, the wasted space is 3.5n. I'll add a citation to clarify this. Dcoetzee 01:37, 20 June 2011 (UTC)
replies: text: Sorry, I forgot to subscribe.  I meant constant space when I said linear a lot.  But I think that there should be some sort of note that there doesn't need to be any wasted space (except for small constant overhead) but that most implementations use geometric expansion.  There is no reason to not use dynamic arrays because of space limitations.  I think the chart should say O(1) and have a sidenote that many implementations use O(n) wasted space because of geometric doubling. Kevin Cox (talk) 16:00, 14 June 2012 (UTC)
replies: text:  I agree that this article should mention alternatives to geometric expansion, so I added a brief note about "Linearly growing arrays". --DavidCary (talk) 05:28, 18 February 2022 (UTC)
thread_title:  Efficiency Chart 

message: "Many scripting languages such as Perl and PHP offer dynamic arrays as a built-in primitive data type."
PHP's array type is not a dynamic array; it is an "ordered map" (PHP manual). It is implemented as a hash table with doubly linked buckets (source code). --Viktor Söderqvist (talk) 15:08, 19 June 2011 (UTC)
thread_title:  Language support 

message: This should not be called a "dynamic array", because it's not an array at all; it's a list data structure backed by an array.
"Dynamic array" has an actual meaning: an array whose size is not static.  For example, .NET arrays are dynamic arrays, (resizeable via Array.Resize,) Java arrays are static only, and Delphi offers both static and dynamic arrays.  All three also have List data structures as part of their standard libraries.  In all three cases, the List data structure is something completely distinct from the array primitive type.  Incorrectly conflating the two leads to confusion, and it should be changed.  — Preceding unsigned comment added by 67.21.63.147 (talk) 20:58, 23 June 2017 (UTC)
replies: text: Wikipedia is not the place for pushing your opinions on what terminology should or should not be used; rather, we reflect the terminology used in reliable sources (see WP:SOAPBOX). Since many sources call this a dynamic array, we should also. —David Eppstein (talk) 21:32, 23 June 2017 (UTC)
replies: text:  Wikipedia also has an article about variable-length arrays: is this a synonym of "dynamic array?" Jarble (talk) 00:23, 7 April 2021 (UTC)
replies: text: I don't think so. A VLA appears to be an array that has a fixed size once it's created, but where that size is determined at runtime rather than compile-time. That's different from a dynamic array, where the array size can change after the array object is created. —David Eppstein (talk) 00:28, 7 April 2021 (UTC)
thread_title:  Terminology 

message: In section Performance, the table has yellow color (everywhere else used for O(log n)) for Linked List => mutate => Middle, and text "peek time + O(1)" but "peek time" is O(n) = red bg color, so "mutate/middle" should also be red. Or am I missing something? — MFH:Talk 22:28, 27 April 2023 (UTC)
thread_title:  Performance(linked list, insert, middle) should be red