Data Structure
The main difference between static and dynamic arrays is the size of the array, which can be fixed or flexible.
Static arrays:
0.Dynamic arrays
Time Complexility
| Operation | Static Array | Dynamic Array |
|---|---|---|
| Access | O(1) | O(1) |
| Search | O(n) | O(n) |
| Insertion | N/A | O(n) |
| Appending | N/A | O(1) |
| Deletion | N/A | O(n) |
Implementation:
Step-1:
Step-2:
Step-3:
Check below link for complete implementation of Custom Dynamic Array.
References: