Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 921 Bytes

File metadata and controls

27 lines (17 loc) · 921 Bytes

Reverse Array

  • Write a function called BinarySearch which takes in 2 parameters: a sorted array and the search key. Without utilizing any of the built-in methods available to your language, return the index of the array’s element that is equal to the value of the search key, or -1 if the element is not in the array.
  • NOTE: The search algorithm used in your function should be a binary search.

Whiteboard Process

Whiteboard Image

Approach & Efficiency

  1. Write out problem statement
  2. Looked at past challenge that used middle split
  3. wrote test cases with given and output
  4. wrote algorithm that follows basic test case
  5. drew image that follows that algorithm
  6. wrote solution on replit
  7. The Big O time is O(log n) and space is O(1)

Solution

Solution

Link to code