Question

2. (25) [Rising trend] Textbook Exercise 17 in Chapter 6. The problem to solve is, in other words, to select from a sequenceYour friends have been studying the closing prices of tech stocks, looking for interesting patterns Theyve defined something

2. (25) [Rising trend] Textbook Exercise 17 in Chapter 6. The problem to solve is, in other words, to select from a sequence of n numbers a subset, including the first number, such that the selected numbers make a longest monotonously increasing sequence. In the exercise b, (i) write an optimal substructure (with an explanation),ii) write the iterative dynamic programming algorithm (pseudocode), and (iii) show the running-time analysis. Hints: the algorithm in the exercise a is a greedy algorithm; the answer returned in the exercise b is the length of the longest rising trend starting from P[1], so think "backward" beginning from P[1]
Your friends have been studying the closing prices of tech stocks, looking for interesting patterns They've defined something called a rising trend, as follows They have the closing price for a given stock recorded for n days in succession; let these prices be denoted P[1], P[2],..,PIn].Arising trend in these prices is a subsequence of the prices P[i1], P[i2],... ,P[ik], for days i12 Pl] then Set i-j Add 1 to L Endif Endf or In your example, give the actual length of the longest rising trend, and say what the algorithm above returns (b) Give an efficient algorithm that takes a sequence of prices P[1], P[2],PIn] and returns the length of the longest rising trend
0 0
Add a comment Improve this question Transcribed image text
Answer #1

For example, -the sequence is ; ו, 4 ,2 ,3 Actual lenqth is 3 -the lenath2 But though Alaorithm, for 3. G. ormula: lere, We a

Add a comment
Know the answer?
Add Answer to:
2. (25) [Rising trend] Textbook Exercise 17 in Chapter 6. The problem to solve is, in other words...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Chapter overview 1. Reasons for international trade Resources reasons Economic reasons Other reasons 2. Difference between...

    Chapter overview 1. Reasons for international trade Resources reasons Economic reasons Other reasons 2. Difference between international trade and domestic trade More complex context More difficult and risky Higher management skills required 3. Basic concept s relating to international trade Visible trade & invisible trade Favorable trade & unfavorable trade General trade system & special trade system Volume of international trade & quantum of international trade Commodity composition of international trade Geographical composition of international trade Degree / ratio of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT