August 2024
Intermediate to advanced
516 pages
11h 47m
English
Deletion from an array is the process of eliminating the value at a particular index.
Let’s return to our original example array and delete the value at index 2. In our example, this value is "cucumbers".
Step 1: We delete "cucumbers" from the array:

While the actual deletion of "cucumbers" technically took just one step, we now have a problem: we have an empty cell sitting smack in the middle of our array. An array isn’t effective when there are gaps in the middle of it, so to resolve this issue, we need to shift "dates" and "elderberries" to the left. This means our deletion process requires additional steps.
Step 2: We shift "dates" ...
Read now
Unlock full access