Answered step by step
Verified Expert Solution
Link Copied!

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. image text in transcribed

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

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 Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

=+LO 2-3 Discuss the importance of four key workplace attitudes.

Answered: 1 week ago

Question

2. How were various roles filled?

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago