-
帖子排序问题
2015-09-01 14:26目前黑客派使用的是 Reddit 的帖子排序算法:
/** * Gets Reddit score. * * @param ups the specified vote up count * @param downs the specified vote down count * @param t time (epoch seconds) * @return reddit score */ private static double redditScore(final int ups, final int downs, final long t) { final int x = ups - downs; final double z = Math.max(Math.abs(x), 1); int y = 0; if (x > 0) { y = 1; } else if (x < 0) { y = -1; } return Math.log10(z) + y * (t - 1353745196) / 45000; }
这个算法很简单有效,具体分析网络上很多,请自行搜索~