Index
Examples
Public Data
Get Example
Empty Example
Remove (Before)
Remove (After)
Examples
We really want to understand capacity well so here is another perspective.
Public Data
We will use the dynamic array by sending messages to it like get, subList, first, last, etc.
All of these public methods only apply to the "Public Data"
Get Example
get(0) is 10
get(1) is 20
get(2) is 30
get(3) is 40
get(4) is an EXCEPTION -- out of bounds
Access is from 0 to (size-1)
Empty Example
Here is a case where we have no elements (size = 0).
We could
not
do any access methods like get, first, last, etc. There is no pubic data.
Remove (Before)
We are about to remove element 20.
Remove (After)
We need to do some shifting to remove the removed slot in the accessible zone.
Data Structures And Algorithms (DSA) (Chapter 304 - Dynamic Array)
Chapter 304 - Dynamic Array
Public vs Private Array Areas
Contents
Intro
Design
Add
Grow
Insert
Remove
Access
Design-2
Memory
Chapter
Top
Search
TOC