Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hirschIndex(Array of int citations)
- k = 0
- counter = 0
- //array including all quoted publications
- int a[citations.length]
- MergeSort(citations, 1, citations.length)
- for i = 1 to i = citations.length do
- //if publication is different than the previous one, increase counter
- if i - 1 > 1 AND citations[i] IS NOT citations[i-1] then
- counter = counter + 1
- end if
- //increase the number of citations of the current publication
- a[counter] = a[counter] +1
- end for
- MergeSort(a, 1, a.length)
- //find out hirschIndex
- for i = a.length down to 1 do
- //if the current publication is quoted more than k times, increase k
- if a[i] > k then
- k = k + 1
- end if
- //if k is now greater than a[i] return k, no following publication is quoted more often than a[i] (a was sorted before)
- if k >= a[i] then
- return k
- end if
- end for
- return 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement