Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have a java programming assignment where part of it includes having to create perform a binary search for an area of values. I know
I have a java programming assignment where part of it includes having to create perform a binary search for an area of values. I know how to code a binary search for a specific element in an array but I don't know how to search for a range of elements.
Image included shows explanation of what we are supposed to do.
Note: In this handout, we use 0-based indexing for arrays. Project: Efficient range search of array elements in a sorted array In this project, we want to efficiently search in a sorted array A[0.1 - 1 for all its member elements whose values fall into a given value range [...y). For example, suppose the following sorted array A is given: A[] = {2,5,5,5,7,9,9, 10, 15, 15, 17, 19} Given a value range [...y] = [6..12), the answer should be A[4..7], because every clement in A[4..7] has a value belonging to the range 6..12and all the other array elements do not. . Given a value range [1..y] = [1.15), the answer should be A(0.9), because all clements from A(0.9) have values belonging to [1..15), while all other array elements do not. Given a value range [...y] = [11..14), the answer should be null, because no array element has a value belonging to this range. Given a value range [...y] = [22..35), the answer should be null, because no array clement has a value belonging to this range. The goal and challenge in this project is to finish the search using O(log n) timeStep 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