当前位置:网站首页>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 much is the data delay when you collect Oracle data? I can't keep it down for 3 seconds. Is there an industry reference
- 全力冲unreal了
- [translation] list of Clickhouse 22.4 and 22.5 core features
- Spark Tuning (submit job resource parameter tuning)
- MCU modifies network hardware driver (PHY chip replacement)
- 58技术沙龙第三十一期|Flutter动态化专题沙龙
- From Mogao Grottoes to the Pacific Ocean, massive data have found new homes
- Redis principle - hash
- Applet graduation project is based on wechat property maintenance application property applet graduation project opening report function reference
猜你喜欢

Kubernetes visual interface dashboard

国内怎么就做不出 IDEA 那样的产品?
![[dark horse morning post] Tencent responded that a large number of users' QQ numbers were stolen; Weiya's husband company was fined 190000 yuan; China Evergrande is applied for liquidation; Guanxiaoto](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] Tencent responded that a large number of users' QQ numbers were stolen; Weiya's husband company was fined 190000 yuan; China Evergrande is applied for liquidation; Guanxiaoto

7-user input and while loop

Industrial digitalization and new generation digitalization system design platform -- Lecture

Win10 compiles curl library source code with cmake3.22 and vs2019 and calls

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

杂记:数据库go,begin,end,for,after,instead of

How to upgrade from RHEL 8 to RHEL 9

全网最全360无死角编写软件测试用例模板【建议收藏】
随机推荐
Small program graduation project based on wechat campus lost and found graduation project opening report function reference
kubeadm创建kubernetes集群
C 语言进阶
Spark调优(提交作业资源参数调优)
9 excellent bitmap services
A few lines of code can realize complex excel import and export. This tool class is really powerful!
Packet capturing and sorting out external Fiddler -- understanding the toolbar [1]
WPF video hard decoding, rendering and playing (no airspace) (support 4K, 8K and high frame rate video)
Idea of capturing mobile terminal variant combination
数据库实验7 完整性约束
IDM certification process log embedding point description
Google launches advanced API security to protect APIs from security threats
Architecture autonomy service: building data-driven architecture insight
JQ plug-in analysis
Introduction to kubernetes resource object and common commands
Applet graduation design based on wechat beauty salon technician appointment applet graduation design opening report function reference
2022年山东省安全员C证考试练习题及模拟考试
软件测试的三个沟通技巧
Small program graduation design based on wechat driving school examination small program graduation design opening report function reference
From Mogao Grottoes to the Pacific Ocean, massive data have found new homes