My notes on Dynamic array
with an implementation in Java.
You can find the complete code for this and other data structures here: data structures and algorithms
A dynamic array
is a data structure
that uses a normal array but allows to increase the size (and in some cases decrease it) to hold more elements.
Common Operations for an array list includes:
Operation |
Complexity |
get(indexOfElement) |
O(1) |
add(value) |
O(1) |
insert(index, value) |
O(n) |
delete(value) |
O(n) |
This is the add operation
And the remove operation
Other operations are very similar to a normal array.
Download the complete code for this and other data structures here: data structures and algorithms