Question: USE C++ only For a given array, write a program with two methods/functions. One function/method for sequential search The other function/method for Binary search The

USE C++ only

For a given array, write a program with two methods/functions.

One function/method for sequential search

The other function/method for Binary search

The program to run as per the users selection (if or switch statement to choose either Binary search or seq search).

hint: create two arrays in main one array is already sorted, the other is not sorted and populate them (hard code) (do not ask the user to enter the number)

size = 20 for both

int num[] = {3, 5, 7,8,...}

when you run the program, run it for both options, search for some elements, if the element you are searching for is found in the array, display a msg, element is found in what location

if the element is not found, display a msg, element was not found.

also, display both arrays

submit the output for all different Scenarios (when target is found and when target is not found) for both algorithms

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 Databases Questions!