data-structures-and-algorithms-401

this repository for challenges in 401

View project on GitHub

Shift 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. input: [A,..,Z],value output:[A..,value,..Z]

Utilize the Single-responsibility principle: any methods you write should be clean, reusable, abstract component parts to the whole challenge. You will be given feedback and marked down if you attempt to define a large, complex algorithm in one function definition.

Stretch Goal Once you’ve achieved a working solution, implement the same feature with a different methodology. (Hint: what different techniques do you have when working with arrays? Recursion, loops, indexes, modifying the array input directly…)

In other words, use a different algorithm & pseudocode to solve the same problem. Then compare approaches for efficiency, readability, flexibility, etc.

Whiteboard Process

array-shift

Approach & Efficiency

I finish with one solution the time for the solution depends on the array length but its going with a linear way.