input: Write a function to implement a binary search algorithm that searches for a target value in a sorted array. If the target value is found in the array, return True, otherwise return False.
  def binarySearch(array, target):
      mid = len(array) // 2
      if array[mid] == target:
          return True
      elif target < array[mid]:
          return binarySearch(array[:mid], target)
      elif target > array[mid]:
          return binarySearch(array[mid+1:], target)
      else:
          return False
  
  assert binarySearch([1, 2, 3, 4, 5, 6, 7], 5) == True
  assert binarySearch([1, 2, 3, 4, 5, 6, 7], 8) == False
  assert binarySearch([], 5) == False
  assert binarySearch([1, 2, 3, 4, 5, 6, 7], 1) == True
  assert binarySearch([1, 2, 3, 4, 5, 6, 7], 7) == True
output: def binarySearch(array, target):
      left, right = 0, len(array) - 1
      while left <= right:
          mid = (left + right) // 2
          if array[mid] == target:
              return True
          elif array[mid] < target:
              left = mid + 1
          else:
              right = mid - 1
      return False