Answered step by step
Verified Expert Solution
Question
1 Approved Answer
class Trendtracker { private: vector trackedHashtags; / / For the mandatory running times below: / / n is the number of hashtags in the Trendtracker.
class Trendtracker
private:
vector trackedHashtags;
For the mandatory running times below:
n is the number of hashtags in the Trendtracker.
public:
Creates a new Trendtracker tracking no hashtags.
Must run in O time.
Trendtracker;
Inserts a hashtag tweeted times into the Trendtracker.
If the hashtag already is in Trendtracker, does nothing.
Must run in On time.
void insertstring ht;
Return the number of hashtags in the Trendtracker.
Must run in O time.
int size;
Adds to the total number times a hashtag has been tweeted.
If the hashtag does not exist in TrendTracker, does nothing.
Must run in On time.
void tweetedstring ht;
Returns the number of times a hashtag has been tweeted.
If the hashtag does not exist in Trendtracker, returns
Must run in On time.
int popularitystring name;
Returns a mosttweeted hashtag.
If the Trendtracker has no hashtags, returns
Must run in On time.
string toptrend;
Fills the provided vector with the mosttweeted hashtags,
in order from mosttweeted to leasttweeted.
If there are fewer than hashtags, then the vector is filled
with all hashtags in mosttweeted to leasttweeted order
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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