Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Debug the code class StockPrice { public: map mp; multiset ms; StockPrice () { } void update(int timestamp, int price) { if(mp.find(timestamp) !=mp.end()) } int
Debug the code
class StockPrice { public: map mp; multiset ms; StockPrice () { } void update(int timestamp, int price) { if(mp.find(timestamp) !=mp.end()) } int { } } auto it=ms.find(mp[timestamp]); ms.erase(it); } int current() { mp[timestamp]=price; ms.insert (price); auto it=mp.end(); it- -; return it->second; maximum () { auto it=ms.end(); return *it; } int minimum() { auto it=ms.begin(); // it--; return *it; }; /** * Your StockPrice object will be instantiated and called as such: * StockPrice* obj = new StockPrice(); * obj->update (timestamp, price); * int param_2 = obj->current(); * int param_3 = obj->maximum(); * int param_4 = obj->minimum(); */
Step by Step Solution
★★★★★
3.35 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
CODE IN C class StockPrice public map rec multiset count void updateint t int p if recfindt recend c...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started