Explore BrainMass

Explore BrainMass

    Range Selection of Unsorted Array

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a method findRanks in Java that accepts an unsorted array of integers vals, and a starting and ending rank start and end, numbering ranks from 0, and returns an unsorted (any order is acceptable) array containing the lo-th through the hi-th elements, inclusive, of vals.

    int[] findRanks(int[] vals, int lo, int hi)

    For instance, if vals contains 10 elements as shown:

    4 2 9 11 9 19 21 14 16 8

    then the call findRanks(vals, 2, 5) will return an array containing the 3rd (remember we number from 0) through 6th items in vals (e.g. 8 9 11 9).

    © BrainMass Inc. brainmass.com December 24, 2021, 5:10 pm ad1c9bdddf

    Solution Summary

    The range selection of unsorted arrays are determined. A method to write a findRanks in Java for an unsorted array are determined.