algorithm - 比较评级算法

标签 algorithm rating

用例: 假设对象的评级为 1 到 5 星。 它已经有 50 票,平均评分为 4.1。 当用户投票(1-5星)时,需要重新计算评分。

如何实现该逻辑?问题是我们不知道每张选票的值(value),只知道当前评级和总票数。

最佳答案

newRating = (oldRating * oldCount + currentVote)/(oldCount + 1)

关于algorithm - 比较评级算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11258747/

相关文章:

php - 尝试连接表时Mysql子查询错误(制作评级系统)

java - 将评级值设置为文本框

php - 使用YouTube API V3 PHP获得视频分级

android - 如何在android studio中实现水平评分条形图?

algorithm - 大O,您如何计算/近似?

c++ - 寻找一个点的 "movement direction"(角度)

algorithm - 创建顺序固定大小的 base 36 id

algorithm - 如何在不使用对偶概念的情况下,在 O(log n) 时间内从一组点中找到距给定查询线最近的点?

algorithm - 是否有任何无法揭示其模式的随机数生成算法?

php - 如何从第三个表中获取数据?