Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Similar to the program I posted for searchArray.cpp. (Exercise) Create - searchArray2.cpp In this part of the lab, you will create a search function (binarysearchL)

image text in transcribedSimilar to the program I posted for searchArray.cpp.

(Exercise) Create - searchArray2.cpp In this part of the lab, you will create a search function (binarysearchL) that is similar to exercise 3 with the following change: You will implement the binary search algorithm iteratively (using a loop) instead of a recursive function. This time all you need to do is to call a search function you create with the following argument:s * a string array A (again, it is a pointer) the number of elements in the array the key to search (a string) Return: 1 if the key was not found, or the index of the (first) element where you found the key Your program should behave the same way as searchArray1.cpp, and you may reuse the main function in searchArray1.cpp Hint: You may use the same logic to find the beginning, end, and mid-point of an array you used for the recursive binary search. You will use a loop to compare the values of the array to the key until the calculated mid-point is the last element. Before writing your binarySearchL function, think about the algorithm and write its pseudocode in the file LogicCheck05 that you created for the previous exercise. You need to turn in the pseudocode to receive full credit. (Exercise) Create - searchArray2.cpp In this part of the lab, you will create a search function (binarysearchL) that is similar to exercise 3 with the following change: You will implement the binary search algorithm iteratively (using a loop) instead of a recursive function. This time all you need to do is to call a search function you create with the following argument:s * a string array A (again, it is a pointer) the number of elements in the array the key to search (a string) Return: 1 if the key was not found, or the index of the (first) element where you found the key Your program should behave the same way as searchArray1.cpp, and you may reuse the main function in searchArray1.cpp Hint: You may use the same logic to find the beginning, end, and mid-point of an array you used for the recursive binary search. You will use a loop to compare the values of the array to the key until the calculated mid-point is the last element. Before writing your binarySearchL function, think about the algorithm and write its pseudocode in the file LogicCheck05 that you created for the previous exercise. You need to turn in the pseudocode to receive full credit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

1 . Television News channels importantance of our Life pattern ?

Answered: 1 week ago