H-指数是衡量科学家生产力和影响的指标。
引用链接的维基百科页面:
H索引是最大的数h,使得h文章至少有h引文.例如,如果作者有五种出版物,其中有9、7、6、2和1引文(从最大到最少),那么作者的h索引是3,因为作者有3种或3种以上的引用。
如何计算PHP中的h索引,给定每个出版物的引用数数组?
<?php
$citations = array(51, 27, 14, 14, 6, 2, 1, 0, 0, 0);在这里,h索引应该是5(如果我没有弄错的话);但是如何在PHP中找到这个结果呢?
发布于 2022-08-29 20:28:16
正如wiki中对algo的解释,我将使用以下内容:
$hIndex = function(array $publications): int {
rsort($publications);
foreach ($publications as $index => $publication) {
if($index >= $publication) {
return $index;
}
}
return 0;
};
echo $hIndex([9, 7, 6, 2, 1]), PHP_EOL;
echo $hIndex([51, 27, 14, 14, 6, 2, 1, 0, 0, 0]), PHP_EOL;
echo $hIndex([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]), PHP_EOL;
echo $hIndex([100, 100, 2, 2, 2, 2, 2, 2, 2, 2]), PHP_EOL;
echo $hIndex([100, 100, 9, 8, 3, 2, 2, 1, 1, 0]), PHP_EOL;打印
3
5
5
2
4https://stackoverflow.com/questions/73534086
复制相似问题