Understanding Static Arrays in Python and their implementations
array
and numpy
.
Operation | Time Complexity | Description |
---|---|---|
Access | O(1) | Direct access by index |
Search | O(n) | Linear search in unsorted array |
Insert | O(n) | Need to shift elements |
Delete | O(n) | Need to shift elements |
Append | O(1)* | When array isn’t full |