USING C++ Programming Binary Search. Use the sorted array that you get in Step 2
ID: 3768471 • Letter: U
Question
USING C++ Programming
Binary Search.
Use the sorted array that you get in Step 2 from question 1 (you can re-use the relevant portions of previous code to get the sorted array),
1. Print the elements of the array. (same as step 3 from previous question)
2. Use Binary Search function to find a number (passed as one of the parameters), constituted of last 3 digits of your UIN. You have to hard code this inside your code. MY LAST 3# UIN is 458
For example: If your UIN is ******123 -> Search for number 123 MY LAST 3# UIN is 458
a. Print the number (Eg: 123)
b. Report if you could find the number (Yes or No) and the array index
3. Perform Binary Search and report, whether or not the user defined value N (positive or negative) is present in the array. Also, if it is present, then print the array index where it was found. Note that, array consists of only positive integers in a specified range as in Program 2. So, even if N given by user is a negative integer, the code should ignore the sign and search for the positive part.
Eg: if N = -5, the program should search for 5 in the array.
Explanation / Answer
program :
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.