š Array Operations in C Size: 7 / 10
Step through contiguous memory shifts, pointer math, and line-by-line C execution.
š» C Source Execution View
GCC / C99
š Variables Watch
Real-time Stack
Values
No active variables
ā” Time Complexity Breakdown
| Operation | Best Case | Worst Case | Description |
|---|---|---|---|
| Access by Index | O(1) | O(1) | Direct memory address calculation |
| Search (Linear) | O(1) | O(n) | Checks elements one by one |
| Search (Binary) | O(1) | O(log n) | Halves array range on sorted data |
| Insertion | O(1) | O(n) | End insert vs index insert (shifts elements) |
| Deletion | O(1) | O(n) | End delete vs index delete (shifts elements) |
š§ C Pointer Arithmetic Formula
In C language, an array variable arr is a pointer constant to &arr[0].
arr[i] ā” *(arr + i)
Address of index i = Base Address + (i * sizeof(datatype))