I'm looking for a reference for the fact that dynamic arrays have random access in constant time and inserting or deleting an element at the end can be done in constant amortized time. What would be a good reference for this?
2026-04-09 09:06:38.1775725598
Reference for Dynamic Arrays
66 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in REFERENCE-REQUEST
- Best book to study Lie group theory
- Alternative definition for characteristic foliation of a surface
- Transition from theory of PDEs to applied analysis and industrial problems and models with PDEs
- Random variables in integrals, how to analyze?
- Abstract Algebra Preparation
- Definition of matrix valued smooth function
- CLT for Martingales
- Almost locality of cubic spline interpolation
- Identify sequences from OEIS or the literature, or find examples of odd integers $n\geq 1$ satisfying these equations related to odd perfect numbers
- property of Lebesgue measure involving small intervals
Related Questions in COMPUTER-SCIENCE
- What is (mathematically) minimal computer architecture to run any software
- Simultaneously multiple copies of each of a set of substrings of a string.
- Ackermann Function for $(2,n)$
- Algorithm for diophantine equation
- transforming sigma notation into harmonic series. CLRS A.1-2
- Show that if f(n) is O(g(n) and d(n) is O(h(n)), then f(n) + d(n) is O(g(n) + h(n))
- Show that $2^{n+1}$ is $O(2^n)$
- If true, prove (01+0)*0 = 0(10+0)*, else provide a counter example.
- Minimum number of edges that have to be removed in a graph to make it acyclic
- Mathematics for Computer Science, Problem 2.6. WOP
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
This is probably the most basic interesting example of amortized analysis, so if you consider any text that covers amortized analysis you will find this. The so-called CLRS algorithms book for example has it. However buying a book to understand dynamic arrays may be a bit overkill unless you want to learn additional things.
Anyway, the idea behind dynamic arrays is if you insert at the end and fill up the array, then you allocate a new array of double the size, move over all the elements into the first half of the new array, and then delete the first array. Also, if the number of elements filled in your array ever becomes less than $1/4$ the size of the array, you create a new array of half the size, copy over all the elements and then delete the old array.
The constants $2$ and $1/4$ and $1/2$ can be played with. The point is, with these constants, at any given time, the amount of memory you are using is no more than $4$ times the number of elements filled, and furthermore, when you reach the point where you grow the array, you have done at least $n/2$ operations where $n$ is the size of the existing array, so the "cost" when you double the size of the array is that you copy $n$ elements, and since you've done at least $n/2$ previous operations, you can say that the charge of $n$ can be distributed out to be an average charge of $2$ to each one of your $n/2$ previous operations. So that "average" is called amortized $O(1)$ time. Similar argument applies when you have to shrink the array.