Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This also uses the solutions for fileIO.cpp and checkArray.cpp from my last post. (Exercise) Create - searchArray1.cpp In this part of the lab, you will
This also uses the solutions for fileIO.cpp and checkArray.cpp from my last post.
(Exercise) Create - searchArray1.cpp In this part of the lab, you will create a recursive function that searches for a key in an array with a binary search algorithm. Revisit lecture 4 for the concept of the binary search algorithm. All you need to do is to repeat splitting an array by half and compare the key to the value of the middle element. In the main function: Input an array from a file. created from the previous exe code that you wrote so far (exercise 2) *Call function (checkArraySort) to check if the array is sorted. So far, you can use the code you rcises. .Exit program if the array is not sorted, otherwise continue to the next steps. Once again, you can use the Prompt the user to input the search key (k) * Call function (binarySearchR) to search for the key recursively .Output your search result: o "Found key "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