
我正在考虑哈希映射的哈希映射.有什么建议 ?
解决方法 外部哈希映射,键入类型为日期,类型为哈希映射的值.内部哈希映射,其键类型为字符串,包含url,int类型的值包含访问次数.
C#中的示例:
// Outer hash map var visitsByDay = new Dictionary<DateTime,VisitsByUrl>(currentDate,new VisitsByUrl());...// inner hash mappublic class VisitsByUrl{ public Dictionary<string,int> Urls { get; set; } public VisitsByUrl() { Urls = new Dictionary<string,int>(); } public voID Add(string url) { if (Urls[url] != null) Urls[url] += 1; else Urls.Add(url,1); }} 总结 以上是内存溢出为你收集整理的algorithm – 为Web服务器设计数据结构以存储访问页面的历史记录全部内容,希望文章能够帮你解决algorithm – 为Web服务器设计数据结构以存储访问页面的历史记录所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)