Linear Search Exercise


Write a Linear Search algorithm!


The function you write should accept two parameters: 1) an array and 2) the value to find.
The function should return the index of the found value, or -1 if not found.

  1. Pair up!
  2. Write pseudocode for this problem! Try to be as thorough and detailed as possible for each step.
  3. Walk through your pseudocode together with your partner using an example/ test case, to make sure each step is doing exactly what you think it should.
  4. Now turn your pseudocode into code! You can use any environment you want to run and test code.
    If you would like premade test cases in Javascript, feel free to fork this repl.

Stumped? Click here for some hints.