Question: CORAL LANGUAGE PLEASE: Define a function named BinarySearch that takes two parameters: an array of integers and an integer value to search for: Function BinarySearch

CORAL LANGUAGE PLEASE: Define a function named BinarySearch that takes two parameters: an array of integers and an integer value to search for: Function BinarySearch() returns the index of value to be searched for, or -1 if not found.
Write a main program that reads integers from input. The first integer is the size of an array, the last integer is the value to be searched for, all other integers will be values of the array. Then the program calls function BinarySearch with the array and the value to be searched for as arguments. Function BinarySearch will return the index of the value to be searched for, or -1 if not found.
Ex: if the input is:
8247101132458710
where 8 is the size of the array, the output is:
Found 10 at index 3
Ex: if the input is:
6241011324510
where 6 is the size of the array, the output is:
Found 10 at index 2
Ex: if the input is:
759111724303314
where 7 is the size of the array, the output is:
14 was not found
Your program should define and use a function:
Function BinarySearch(integer array(?) numbers, integer key) returns integer found13.5 LAB: Algorithm 1 Binary Search
Define a function named BinarySearch that takes two parameters: an array of integers and an integer value to search for: Function
BinarySearch() returns the index of value to be searched for, or -1 if not found.
Write a main program that reads integers from input. The first integer is the size of an array, the last integer is the value to be searched for,
all other integers will be values of the array. Then the program calls function BinarySearch with the array and the value to be searched for as
arguments. Function BinarySearch will return the index of the value to be searched for, or -1 if not found.
Ex: if the input is:
8247101132458710
where 8 is the size of the array, the output is:
Found 10 at index 3
Ex: if the input is:
6241011324510
where 6 is the size of the array, the output is:
Found 10 at index 2
Ex: if the input is:
759111724303314
where 7 is the size of the array, the output is:
14 was not found
Your program should define and use a function:
Function BinarySearch(integer array(?) numbers, integer key) returns integer found
LAB
ACTIVITY
13.5.1: LAB: Algorithm 1 Binary Search
010
CORAL LANGUAGE PLEASE: Define a function named

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!