3. (14%) Let A[1..n] be an array of n positive numbers. Entry A[i] represents the trading price of a stock X on the i-th

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

3. (14%) Let A[1..n] be an array of n positive numbers. Entry A[i] represents the trading price of a stock X on the i-th

Post by answerhappygod »

3 14 Let A 1 N Be An Array Of N Positive Numbers Entry A I Represents The Trading Price Of A Stock X On The I Th 1
3 14 Let A 1 N Be An Array Of N Positive Numbers Entry A I Represents The Trading Price Of A Stock X On The I Th 1 (20.31 KiB) Viewed 48 times
3. (14%) Let A[1..n] be an array of n positive numbers. Entry A represents the trading price of a stock X on the i-th day (and hence the numbers are ordered chronologically). Write an algorithm max-profit that returns a pair (a, b) such that if one buys stock X on the a-th day and sells it on the b-th day, the maximum profit is made. Give the time complexity of your algorithm in Big-O. Show the derivation of the complexity result. о
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply