In the last post we have already discussed traversing an array. Now in this post we are going to discuss insertion in an array.
Insertion in array
An element can be inserted in an array at a specified position.
In order to perform insertion operations, the array should have enough capacity.
Note- When no position is specified it’s better to insert an element at the end.
Visual Representation
Let’s consider an array of 6 integers.
If we want to insert 40 item at position 3 then the procedure will be as follows -
Procedure
Algorithm
Code Snippet 1 - insertion operation
When you will post deletion?
ReplyDeleteeagerly wating for deletion.
Nice! But why there is no copy button in source code?
ReplyDeleteNice
ReplyDeletehello! when are you coming back?
ReplyDeleteSoon!
Delete