A small computation-intensive investment company needs to solve the following type of data analysis task over and
Fantastic news! We've Found the answer you've been seeking!
Question:
A small computation-intensive investment company needs to solve the following type of data analysis task over and over again. The daily price of a stock is given in an array A[1..n]. (A[1] is the stock price on day 1 etc. n can be fairly large, say we have data for 30 years.) The task is to determine the largest possible profit during the period of the stock. Specifically, we need to find i, j such that (1) 1 ≤ i ≤ j ≤ n , and (2) A[j] − A[i] is maximum. We can easily solve the problem in Θ(n2 ) time. However, n is large and we need to analyze many stocks. Design a DaC algorithm for solving this?
Related Book For
Posted Date: