data-structures-and-algorithms-java

Insert to Middle of an Array

Write a function called insertShiftArray which takes in an array and a value to be added. Without utilizing any of the built-in methods available to your language, return an array with the new value added at the middle index.

Whiteboard Process

whitboard

Approach & Efficiency

create a new array store the values from the old array in it until the middle then shift the other values by 1 and store them .

Big O : O(n).