subject
Mathematics, 21.04.2020 22:21 MogTaee

We're looking at the price of a given stock over n consecutive days, numbered i = 1,2, …, n. For each day i, we have a price p(i) per share for the stock on that day. (We'll assume for simplicity that the price was fixed during each day.) We'd like to know: How should we choose a day i on which to buy the stock and a later day j > i on which to sell it, if we want to maximize the profit per share, p(j) - p(i)? (If there is no way to make money during the n days, we should conclude this instead.) In the solved exercise, we showed how to find the optimal pair of days i and j in time O(n log n). But, in fact, it's possible to do better than this. Show how to find the optimal numbers i and j in time O(n).

ansver
Answers: 3

Another question on Mathematics

question
Mathematics, 21.06.2019 15:00
The heaviest 16% of all men in weight weigh more than how many pounds ?
Answers: 1
question
Mathematics, 21.06.2019 15:30
Which polynomial function has x intercepts -1, 0, and 2 and passes through the point (1, -6)
Answers: 2
question
Mathematics, 21.06.2019 15:50
Name the most appropriate metric unit for each measurement
Answers: 3
question
Mathematics, 21.06.2019 20:30
There are 45 questions on your math exam. you answered 810 of them correctly. how many questions did you answer correctly?
Answers: 3
You know the right answer?
We're looking at the price of a given stock over n consecutive days, numbered i = 1,2, …, n. For eac...
Questions
question
Mathematics, 19.03.2021 22:40
question
Mathematics, 19.03.2021 22:40
question
Medicine, 19.03.2021 22:40
Questions on the website: 13722361