Commit 8ed4fc7
committed
feat: Implement element deletion from array by index with left shift
🧠 Logic:
- Initialize an array `A` with 6 elements and size tracker `n = 6`.
- To delete an element at a given `index`, shift all subsequent elements one position to the left.
- Decrease the array size (`n--`) to exclude the last redundant value.
- Print the array before and after deletion to visualize the change.
Signed-off-by: Somesh diwan <[email protected]>1 parent 22961f3 commit 8ed4fc7
1 file changed
+6
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
18 | 16 | | |
19 | | - | |
20 | | - | |
| 17 | + | |
21 | 18 | | |
22 | 19 | | |
23 | | - | |
24 | 20 | | |
25 | 21 | | |
26 | | - | |
27 | 22 | | |
28 | 23 | | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
32 | 27 | | |
33 | | - | |
| 28 | + | |
| 29 | + | |
34 | 30 | | |
35 | | - | |
| 31 | + | |
| 32 | + | |
0 commit comments