Question: Write in JAVA a dive and conquer algorithm for determining the best time to purchase and the best time to sell a stock. Assume the
Write in JAVA a dive and conquer algorithm for determining the best time to purchase and the best time to sell a stock. Assume the price of the stock vs the time is represented by the array S of integers. Compute the complexity of your algorithm.
The complexityshould be not more than (nlogn). i.e Given an array A of non-negative integers of size n. Find the two indices p and s , 0==p>=n-1>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
