Question
In java, write an (n log n) recursive divide and conquer algorithm for the following problem: (comments in code for major steps) Given an array
In java, write an (n log n) recursive divide and conquer algorithm for the following problem: (comments in code for major steps)
Given an array that contains n values of doubles, find the two indexes with the biggest difference, where the larger number must be in an index later in the array than the smaller number.
For example:
Given n = 10, Array = [86.3, 29.38, 59.6091, 29.29, 36.5, 54.01, 22.21, 63.8, 15.75, 29.25]
Should return index 6 for the smaller value cell location, index 7 for the larger value cell location, and the difference of 41.59.
Given n = 5, Array = [23,3,9,16,2]
Should return index 1 for the smaller, index 3 for the larger and the difference of 13.
Step 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