Question
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
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started