1) 某一个用户积分发生变化的时候,更新排行榜数据结构
2) 使用用户名,获取用户排名
3) 获取第n 名用户名和积分
问题:
1) 当 N=1000 时,请写出TopList 类中未完成的成员函数?
struct UserInfo
{
string name;
long score;
bool operator<(const UserInfo& rhs)
{
1,______
}
};
struct TopList
{
public:
//刷新排行榜
bool Refresh TopList(const UserInfo& user)
{
2,______
}
//根据用户名活的用户排名
int GetRankByUserName(string& name)
{
3,______
}
//根据用户名次取得用户信息
UserInfo* GetUserByRank(long rank)
{
4,______
}
private:
std::multiset items_;
};
2)当N=1000万时,设计排行榜的数据结构,和相关操作的算法?(伪代码表示)
