Given an array of integers and we have to insert an item (element/number) at specified (given) position.
To insert element into an array at given position:
We have to reach at that particular position by traversing the array, shift all elements one position ahead. And then insert the element at given position.
For example we have list of integers:
10 12 15 8 17 23
Now we insert new element 17 at 3rd position then
10 12 17 15 8 17 23
Consider the example:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer