- 浏览: 174839 次
- 性别:
- 来自: 济南
文章分类
最新评论
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.
According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more than h citations each."
For example, given citations = [3, 0, 6, 1, 5], which means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, his h-index is 3.
Note: If there are several possible values for h, the maximum one is taken as the h-index.
h-index ,又称为h指数或h因子(h-factor),是一种评价学术成就的新方法。h代表“高引用次数”(high citations),一名科研人员的h指数是指他至多有h篇论文分别被引用了至少h次, 剩余的论文引用的次数不多于h次。题目中给定了一个数组,数组的长度就代表了论文的个数,每个元素的值代表了引用的次数,让我们从中找到H-index.
首先我们设定h的初始值为1。然后我们将数组排序,从最后一个元素开始与h比较,1,如果比h大,就让h加1,继续往前比较,直到遇到等于或者小于h的情况;2, 如果等于h, 就返回h; 3,如果小于h, 就返回h - 1。在第1步中,如果一直都大于h, 我们就返回数组的长度。我们用到了排序,这样时间复杂度为O(nlogn)。代码如下:
另外一种方法只用O(n)的时间复杂度就可以解决,但是我们要用到O(n)的空间。类似于计数排序的方法,创建一个数组count来记录文章引用次数的情况,然后从count的最后一个元素开始累加,当累加的数字大于或等于当前下标的时候就返回。代码如下:
According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more than h citations each."
For example, given citations = [3, 0, 6, 1, 5], which means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, his h-index is 3.
Note: If there are several possible values for h, the maximum one is taken as the h-index.
h-index ,又称为h指数或h因子(h-factor),是一种评价学术成就的新方法。h代表“高引用次数”(high citations),一名科研人员的h指数是指他至多有h篇论文分别被引用了至少h次, 剩余的论文引用的次数不多于h次。题目中给定了一个数组,数组的长度就代表了论文的个数,每个元素的值代表了引用的次数,让我们从中找到H-index.
首先我们设定h的初始值为1。然后我们将数组排序,从最后一个元素开始与h比较,1,如果比h大,就让h加1,继续往前比较,直到遇到等于或者小于h的情况;2, 如果等于h, 就返回h; 3,如果小于h, 就返回h - 1。在第1步中,如果一直都大于h, 我们就返回数组的长度。我们用到了排序,这样时间复杂度为O(nlogn)。代码如下:
public class Solution { public int hIndex(int[] citations) { if(citations == null || citations.length == 0) return 0; Arrays.sort(citations); int h = 1; for(int i = citations.length - 1; i >= 0; i--) { if(citations[i] > h) { h ++; } else if(citations[i] == h) { return h; } else { return h - 1; } } return citations.length; } }
另外一种方法只用O(n)的时间复杂度就可以解决,但是我们要用到O(n)的空间。类似于计数排序的方法,创建一个数组count来记录文章引用次数的情况,然后从count的最后一个元素开始累加,当累加的数字大于或等于当前下标的时候就返回。代码如下:
public class Solution { public int hIndex(int[] citations) { if(citations == null || citations.length == 0) return 0; int len = citations.length; int[] count = new int[len + 1]; for(int i = 0; i < len; i++) { if(citations[i] >= len) count[len] ++; else count[citations[i]] ++; } for(int i = count.length - 1; i > 0; i--) { if(count[i] >= i) return i; count[i - 1] += count[i]; } return 0; } }
发表评论
-
498. Diagonal Traverse
2019-11-15 13:52 229Given a matrix of M x N eleme ... -
496 Next Greater Element I
2019-11-14 13:50 233You are given two arrays (witho ... -
Word Break II
2016-03-09 03:15 349Given a string s and a dictiona ... -
Insert Interval
2016-03-08 02:11 343Given a set of non-overlapping ... -
Merge Intervals
2016-03-07 05:25 462Given a collection of intervals ... -
Merge k Sorted Lists
2016-03-07 04:03 526Merge k sorted linked lists and ... -
Multiply Strings
2016-03-06 07:27 438Given two numbers represented a ... -
N-Queens II
2016-03-06 03:06 625Follow up for N-Queens problem. ... -
N-Queens
2016-03-06 02:47 436The n-queens puzzle is the prob ... -
First Missing Positive
2016-03-05 03:09 394Given an unsorted integer array ... -
Spiral Matrix
2016-03-04 03:39 522Given a matrix of m x n element ... -
Trapping Rain Water
2016-03-04 02:54 543Given n non-negative integers r ... -
Repeated DNA Sequences
2016-03-03 03:10 379All DNA is composed of a series ... -
Increasing Triplet Subsequence
2016-03-02 02:48 871Given an unsorted array return ... -
Maximum Product of Word Lengths
2016-03-02 01:56 886Given a string array words, fin ... -
LRU Cache
2016-02-29 10:37 564Design and implement a data str ... -
Super Ugly Number
2016-02-29 07:07 612Write a program to find the nth ... -
Longest Increasing Path in a Matrix
2016-02-29 05:56 772Given an integer matrix, find t ... -
Coin Change
2016-02-29 04:39 741You are given coins of differen ... -
Minimum Height Trees
2016-02-29 04:11 635For a undirected graph with tre ...
相关推荐
在网上没有搜到关于H-index因子的代码,于是自己写了个与大家分享。
对H-index的增长建模与预测,刘逸彬,李言辉,H-index(H指数)是一个在文献计量学领域被广泛使用的用来量化个人科学研究成果的指标。本文提出了一个描述H-index 增长的模型,并找出�
高引文章5年h-index的研究,王川奇,李言辉,在期刊质量评价研究中,许多学者提出了新的指数去辅助IF进行期刊学术质量的评价。但是在我们的研究中发现,并没有一个基于即时数据�
Scholar H-Index Calculator是一种文献计量和引文分析工具,可作为Google Chrome浏览器的插件,在Google Scholar页面的顶部提供更多见解。使用方法:只需访问Scholar.google.com并进行查询。增强的信息将在常规的...
您可以通过修改pages/index.js来开始编辑页面。 页面在您编辑文件时自动更新。 可以在上访问。 可以在pages/api/hello.js编辑此端点。 pages/api目录映射到/api/* 。 此目录中的文件被视为而不是React页面。 学到...
├── index.html 首页(主框架) ├── welcome.html 我的桌面(默认永远打开的页面) ├── member-开头的 用户相关 ├── artice-开头的 资讯相关 ├── picture-开头的 图片相关 ├── product-开头的...
H-ui.admin是用H-ui前端框架开发的轻量级网站后台模版 采用源生html语言,完全免费,简单灵活,兼容性好 让您快速搭建中小型网站后台 程序员的的福音 \根目录 │ _blank.html 空白页(每次我们都拿空白页去创建,...
│ index.html 首页(主框架) │ welcome.html 我的桌面(默认永远打开的页面) │ member-开头的 用户相关 │ artice-开头的 资讯相关 │ picture-开头的 图片相关 │ product-开头的 产品相关 │ page-开头的 ...
Roles of degree, H-index and coreness in link prediction of complex networks
H-ui.admin是用H-ui前端框架开发的轻量级网站后台模版采用源生html语言,完全免费,简单灵活,兼容性好,让您快速搭建中小型网站...Demo地址:http://www.h-ui.net/H-ui.admin/v2.4/index.html 标签:后台模版
H-ui前端框架系统是基于 HTML、CSS、JAVASCRIPT开发的轻量级web前端框架 http://www.h-ui.net/index.shtml 。这里是官方的网址,可以 免费下载的。我这里仅做保存一下。
├── index.html 首页(主框架) ├── welcome.html 我的桌面(默认永远打开的页面) ├── member-开头的 用户相关 ├── artice-开头的 资讯相关 ├── picture-开头的 图片相关 ├── product-开头的...
H-Viewer Sites All sites for H-Viewer 注:这个列表已不再更新,获取最新最全的站点请在应用内的站点市场 Sites ACG图站 —— ACG picture sites ID Site's Json QR Code Author 1 PureDark 2 PureDark & Booru图...
ALTEGRAD H指数预测挑战 在此回购中,您将找到ALTEGRAD课程竞赛中用于提交的笔记本。
h -Index : h -Index 为h 的学者至少发表了h篇论文,每篇论文至少被引用了h次。 归一化的ħ -索引:A和NH的归一化ħ -索引学者由于第一纸张,其中的每一个已被引用至少NH倍已出版至少NH论文。 Per-Coauthor ...
安装 # Globally – for a user:npm install --global less-index# …or locally – for a project:npm install --save-dev less-index用法概要 Usage: less-index [] ...<directory> or: less-index (-h|--help)...
在本文中,我们提出了一种局部h-index中心度(LH-index)方法来识别和排序网络中的影响节点。 LH-index方法同时考虑了节点本身及其邻居的h-index值,这是基于这样一个想法,即连接到更具影响力的节点的节点也将具有...
For the few scientists who earn a Nobel prize, the impact and relevance of their research is unquestionable. Among the rest of us, how does one quantify the cumulative impact and relevance of an ...
Their indexing pipeline was an involved multistep process that produced an index about two orders of magnitude larger, on aver‐ age, than your standard term-based index. The datastore that they’d ...
AMiner平台推荐了各领域代表性的期刊/会议,并由专家进行补充,挖掘这些期刊/会议近10年论文,确定了h-index排名前2000的学者,构建各领域学者库。我们将这些学者供职机构的位置信息绘制于地图上得到了学者分布地图...