Question: 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. I have a java programming assignment where part of it includes having

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) time

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!