Skip to content

Latest commit

 

History

History

h_index_ii

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Problem

Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm?

Hint:

Expected runtime complexity is in O(log n) and the input is sorted.

Solution

Ternary search for unimodal functions: https://en.wikipedia.org/wiki/Ternary_search