parameters: (n)
docstring: Perform a Binary search on a list of size n.
  
      Returns the number of key comparisons made and
      the time taken for the algorithm to run.
docstring_summary: Perform a Binary search on a list of size n.
docstring_tokens: Perform a Binary search on a list of size n .
function: def test_binary_search(n):
      """
      Perform a Binary search on a list of size n.
  
      Returns the number of key comparisons made and
      the time taken for the algorithm to run.
      """
      sample_list = list(range(n))  # create a sorted list of n keys
      search_key = randint(0, n - 1)
  
      print("\nBinary Searching for", search_key, "in a list of", n, "items")
  
      start = time.time()
      key_comparisons_made = binary_search_count(sample_list, search_key)
      end = time.time()
  
      result = "For binary search of {} items, {} comparisons of keys were used"
      time_taken = "Time taken: {:.4f} milliseconds elapsed"
      print(result.format(n, key_comparisons_made))
      print(time_taken.format((end - start) * 1000))
function_tokens: def test_binary_search ( n ) : sample_list = list ( range ( n ) ) # create a sorted list of n keys search_key = randint ( 0 , n - 1 ) print ( "\nBinary Searching for" , search_key , "in a list of" , n , "items" ) start = time . time ( ) key_comparisons_made = binary_search_count ( sample_list , search_key ) end = time . time ( ) result = "For binary search of {} items, {} comparisons of keys were used" time_taken = "Time taken: {:.4f} milliseconds elapsed" print ( result . format ( n , key_comparisons_made ) ) print ( time_taken . format ( ( end - start ) * 1000 ) )