当前位置:网站首页>Go descending sort takes top n
Go descending sort takes top n
2022-06-28 18:18:00 【Zen and the art of computer programming】
func top(result *[]*competition_detail.BrandWord, topN int) {
sort.SliceStable(*result, func(i, j int) bool {
return (*result)[i].ProductFrequency > (*result)[j].ProductFrequency
})
if len(*result) > topN {
*result = (*result)[0:topN]
}
}
type BrandWord struct {
ProductPropertyValue string `thrift:"product_property_value,1" json:"product_property_value"`
ProductFrequency int64 `thrift:"product_frequency,2" json:"product_frequency"`
}边栏推荐
- How to open a futures account? Where is it safer to open an account?
- 数据库MySQL语句期末复习 CTGU
- 问下 flink sql cdc. 能同步多张表然后sink到一份表中么 同步的表通过 joi
- How much is the data delay when you collect Oracle data? I can't keep it down for 3 seconds. Is there an industry reference
- 7-user input and while loop
- Google launches advanced API security to protect APIs from security threats
- Small program graduation project based on wechat campus lost and found graduation project opening report function reference
- IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021
- The fourth largest operator cannot be a "catfish"
- TDengine  × Intel edge insight software package accelerates the digital transformation of traditional industries
猜你喜欢

win10用cmake3.22与vs2019编译curl库源码并调用

Small program graduation project based on wechat mobile mall small program graduation project opening report function reference

Mycat+ sub database and sub table

Small program graduation design based on wechat driving school examination small program graduation design opening report function reference

Database mysql statement final review CTGU

58技术沙龙第三十一期|Flutter动态化专题沙龙
![抓包整理外篇fiddler————了解工具栏[一]](/img/f4/fa909f30c0097fb77cea10eb0d3109.png)
抓包整理外篇fiddler————了解工具栏[一]

IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021

Small program graduation design based on wechat real estate intermediary house viewing appointment small program graduation design opening report function reference

MySQL十种锁,一篇文章带你全解析
随机推荐
麻醉不止“打一针”那么简单,无痛、安全、舒适为患者首选
节点基础~节点层级
Applet graduation project is based on wechat property maintenance application property applet graduation project opening report function reference
MySQL十种锁,一篇文章带你全解析
TDengine  × Intel edge insight software package accelerates the digital transformation of traditional industries
7-user input and while loop
halcon知识:矩阵专题【01】
Node foundation ~ node level
[tcapulusdb knowledge base] modify business modify cluster
9 excellent bitmap services
[official cooperation between Shang Silicon Valley and Tencent cloud] video release of Silicon Valley classroom project
2022危险化学品生产单位安全生产管理人员复习题及答案
DNSLog注入
Small program graduation design based on wechat real estate intermediary house viewing appointment small program graduation design opening report function reference
[algorithm] I brushed two big factory interview questions and learned array again with tears in my eyes“
通达信能开户炒股吗?安全吗?
全力冲unreal了
9个优秀的占位图服务
Small program graduation project based on wechat examination small program graduation project opening report function reference
几行代码就能实现复杂的 Excel 导入导出,这个工具类真心强大!