Binary Search Exercise
Write a Binary 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.
- Pair up!
- Write pseudocode for this problem! Improve on the steps from the Binary Search: Steps slide.
Can you get those steps as close to actual code as possible?
- 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.
- Now turn your pseudocode into code! You can use any environment you want to run and test code.
Stumped? Click here
for some hints.