Section 4: Dynamic Arrays — Structure and Behavior (37–48)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

12 Terms

1
New cards

Underlying storage mechanism of a dynamic array

A backing array

2
New cards

Dynamic array size

The number of elements currently stored

3
New cards

Dynamic array capacity

The number of elements the backing array can hold before needing to resize

4
New cards

Relationship between dynamic array size and capacity

They can differ because capacity can exceed size

5
New cards

Dynamic array resizing trigger

Attempting to add an element when the backing array is completely full

6
New cards

Common growth strategy for dynamic array capacity

Doubling the existing capacity

7
New cards

Reason elements are copied during dynamic array resizing

To transfer all existing elements from the old backing array into the new, larger backing array

8
New cards

Dynamic-array constructor

Initializes the data structure and establishes its initial state, including its size and capacity

9
New cards

Class invariant

A condition or rule that must always hold true for an object's state to be considered valid

10
New cards

Purpose of checking class invariants after an operation

To verify that the operation maintained internal rules and left the data structure in a valid state

11
New cards

Amortized analysis

An evaluation technique that determines the average cost per operation over a sequence of operations

12
New cards

Reason dynamic array addition achieves amortized efficiency

Expensive resizing operations occur infrequently, allowing their high cost to be distributed across many constant-time additions